下面是使用的 Javascript 代码。
google.load("elements", "1", {packages : ["newsshow"]});
function loadNews(newsQuery)
{
//Load the news feed according to the topic selected
var options =
{
"format": "300x250",
"queryList" :
[
{
"title" : newsQuery,
"q" : newsQuery
}
]
}
var content = document.getElementById('content');
var newsShow = new google.elements.NewsShow(content, options);
}
newsAddress 值是用户输入的文本框值。并且基于文本框的值,div 元素“内容”会更新为一个新元素。
我的问题是,每次当我在文本框 (newsAddress) 中输入一个值时,“内容”元素中的一个新闻项都会被插入到另一个下方。我的要求是根据新的搜索条件更新相同的新闻元素。
如何才能做到这一点?