XML – RSS feed

[Total: 0    Average: 0/5]

This script allows you to have RSS news feeds displayed on your web site without the need for CGI or server side scripting.

Head Code:


// Helper function that generates an HTML <TABLE> element to display the list of news items 

function getrss(rsslink) { 
var newxml = document.createElement("XML"); 
newxml.async = false; 

var sitetitle=newxml.selectNodes( "//channel" ).item( 0 ).selectSingleNode( "title" ).text 
var strHTML = "<TABLE><TH style='font-size: 12;'>"+sitetitle+"</TH><tr>"; 

var newsitems = newxml.selectNodes( "//item" ); 

// Walk the list of <items> nodes to generate the appropriate HTML 
for( var i = 0; i < newsitems.length; i++ ) { 

strHTML += "<td style='font-size: 12;'><a href='"+newsitems.item( i ).selectSingleNode( "link" ).text +"' "; 
strHTML += " title='"+ newsitems.item( i ).selectSingleNode( "description" ).text + "'>"; 
strHTML += newsitems.item( i ).selectSingleNode( "title" ).text + "</a></td>"; 
strHTML += "</TR>"; 

strHTML += "</TABLE>"; 
return strHTML; 

Body Code:

<DIV ID="Newsdotcomrss" ></DIV> 


Times Viewed: 12

Leave a Reply

Your email address will not be published. Required fields are marked *