Looking for RSS feed script

M

Mic

Hi,

After hours of searching, I was not able to find a Javascript script
to embed RSS feeds on a html page. I don't want to use an external
site which has the script. I want to use my own script.

If somebody could point me in the right direction, I would be willing
to write my own script if I have instructions on how to parse the RSS.

Thanks
 
L

Leif902

I don't know about the legalities of this script, I found it online
somewhere, I beleive that the author said anyone could use it as long
as, if you ever met him, you'd buy him a beer (not joking either)...

<script language="javascript" type="text/javascript">
var rssDoc = new ActiveXObject("MSXML2.DOMDocument.3.0");
rssDoc.onreadystatechange = popData;

function displayRSS(path){
mainTitle.href = "";
mainTitle.innerHTML = "";
items.innerHTML = "";

rssDoc.load(path);
}

function popData(){
if(rssDoc.readyState!=4)
return;

// Title
mainTitle.href = rssDoc.selectSingleNode("/rss/channel/link").text;
mainTitle.innerHTML = rssDoc.selectSingleNode("/rss/channel/
title").text;

// Items
var rssItems = rssDoc.selectNodes("/rss/channel/item");
for(var i=0;i<rssItems.length;i++)
{
// Do all formatting here!
var item='<li><a href="' + rssItems.selectSingleNode("./
link").text + '" class="itemTitle">';
item+=rssItems.selectSingleNode("./title").text
item+='</a><br/><div class=item>';
item+=rssItems.selectSingleNode("./description").text;
item+='</div></li>';
items.innerHTML+=item;
}

}
</script>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,880
Members
47,417
Latest member
DarrenGaun

Latest Threads

Top