分类:
2008-04-14 15:55:55
msnWebSearch.populateResults = function(divResultsPane,oParser){ var oFragment = document.createDocumentFragment(); divResultsPane.removeChild(divResultsPane.firstChild); |
for (var i = 0; i < oParser.items.length; i++) { var oItem = oParser.items[i]; var aResultLink = document.createElement("a"); aResultLink.href = oItem.link.value; aResultLink.className = "ajaxWebSearchLink"; aResultLink.target = "_new"; aResultLink.appendChild(document.createTextNode(oItem.title.value)); oFragment.appendChild(aResultLink); } |
divResultsPane.appendChild(oFragment); |
msnWebSearch.close = function () { var divSearchBox = this.parentNode.parentNode; document.body.removeChild(divSearchBox); return false; }; |
msnWebSearch.search = function (e,sSearchTerm) { var divSearchBox = this.drawResultBox(e); var url = encodeURI("websearch.php?search=" + sSearchTerm); var oParser = new XParser(url); oParser.onload = function () { msnWebSearch.populateResults(divSearchBox.childNodes[1],oParser); }; }; |