复制代码 代码如下:
//Containerforticker.ModifyitsSTYLEattributetocustomizestyle:
vartickercontainer=''
varxmlsource="http://rss.mydrivers.com/Fitting_News.xml";
varroot;
vartitle;
varlink;
varitems;
varitem;
varimages;
varimage;
vardescription;
if(window.ActiveXObject)
{
//document.write("Microsoft.XMLDOM");
varxmlDoc=newActiveXObject("Microsoft.XMLDOM");
}
elseif(document.implementation&&document.implementation.createDocument)
{
//document.write("document.implementation.createDocument");
varxmlDoc=document.implementation.createDocument("","doc",null);
}
if(typeofxmlDoc!="undefined")
{
//document.write(tickercontainer)
xmlDoc.load(xmlsource)
}
functionfetchxml()
{
if(xmlDoc.readyState==4)
output()
else
setTimeout("fetchxml()",10)
}
functionoutput()
{
vartemp="";
root=xmlDoc.getElementsByTagName("channel")[0];
title=root.getElementsByTagName("title")[0];
//temp=title.firstChild.nodeValue+"
";
items=root.getElementsByTagName("item");
for(i=0;i<=items.length-1;i++)
{
item=items[i];
title=item.getElementsByTagName("title")[0];
link=item.getElementsByTagName("link")[0];
description=item.getElementsByTagName("description")[0];
temp=temp+"
";
//temp=temp+"
";
document.getElementById("container").innerHTML=temp;
}
}
if(window.ActiveXObject)
fetchxml()
elseif(typeofxmlDoc!="undefined")
xmlDoc.onload=output