JS Read RSS

Source: Internet
Author: User



<title>javascript Reading RSS Data </title>
<meta content= "text/html; Charset=utf-8 "Http-equiv=content-type/>

<body leftmargin= "0" topmargin= "0" >
<font>

<br>
<table width= "90%" align= "center" border= "0" cellpadding=0 cellspacing=0>
<tr>
&LT;TD bgcolor=white><b> News Center </b><font size= "1" > (excerpt from Sina) </font></tr>
<tr>
&LT;TD bgcolor=white>
<div id= "Container" >news loading...</div>
</td>
</tr>
</table>
<script language= "JavaScript1.2" >
var tickercontainer= '
var xmlsource= "Http://rss.mydrivers.com/Fitting_News.xml";
var root;
var title;
var link;
var items;
VAR item;
var images;
var image;
var description;
if (window. ActiveXObject) {
document.write ("Microsoft.XMLDOM");
var xmldoc = new ActiveXObject ("Microsoft.XMLDOM");
} else if (document.implementation && document.implementation.createDocument) {
document.write ("Document.implementation.createDocument");
var xmldoc= document.implementation.createDocument ("", "Doc", NULL);
}
if (typeof xmldoc!= "undefined") {
document.write (Tickercontainer)
Xmldoc.load (Xmlsource)
}
function FetchXML () {
if (xmldoc.readystate==4) {
Output ()
}else {
SetTimeout ("FetchXML ()", 10)
}
}
function output () {
var temp= "";
Root = Xmldoc.getelementsbytagname ("channel") [0];
Title =root.getelementsbytagname ("title") [0];
temp = Title.firstChild.nodeValue + "<br>";
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 + "<font size=-1><a href=" + link.firstchild.nodevalue+ "target= ' _bank ' >" + title.firstChild.node Value + "</a></font><br><br>";
Temp = temp + "<font size=-1>" + description.firstChild.nodeValue + "</font><br><br>";
document.getElementById ("container"). InnerHTML = temp;
}
}
if (window. ActiveXObject) {
FetchXML ();
} else if (typeof xmldoc!= "undefined") {
Xmldoc.onload=output;
}
</script>
</body>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.