This Domain(Admin5.com) is for Sale:

利用Yahoo! Search API开发自已的搜索引擎-javascript版

时间:2007-10-22  来源:不详  作者:林子

var totalResultsReturned = parseInt(resultSet.getAttribute("totalResultsReturned"));
var firstResultPosition = parseInt(resultSet.getAttribute("firstResultPosition"));
var start = firstResultPosition;
var end = firstResultPosition totalResultsReturned - 1;
var results = xmlDoc.getElementsByTagName("Result");
for (var i = 0; i < results.length; i ) {
var result = results[i];
var title = result.getElementsByTagName('Title')[0].firstChild.nodeValue;
var summary = '';
if (result.getElementsByTagName('Summary')[0].firstChild) {
summary = result.getElementsByTagName('Summary')[0].firstChild.nodeValue;
}
var clickUrl = result.getElementsByTagName('ClickUrl')[0].firstChild.nodeValue;
var url = result.getElementsByTagName('Url')[0].firstChild.nodeValue;
retVal[i] = { I: start i, Title: title, Summary: summary, ClickUrl: clickUrl, Url: url };
}
copyright dedecms

return retVal;
} catch(exception) {
alert('Exception occurred while reading XML (i=' i '; start=' start ';end=' end '): ' exception);
}
} dedecms.com


有兴趣的朋友还可以看一下由[动态网站制作指南]所制作的ASP版本:http://www.knowsky.com/yahoo/

dedecms.com

看完这篇,您有何感觉呢?

文章评论

共有位Admini5网友发表了评论 查看完整内容

24小时热门信息