/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<html> <head> <script type="text/javascript"> function getFeed(feed) { var newScript = document.createElement('script'); newScript.type = 'text/javascript'; newScript.src = 'http://pipes.yahoo.com/pipes/9oyONQzA2xGOkM4FqGIyXQ/run?&_render=json&_callback=piper&feed='+feed; document.getElementsByTagName("head")[0].appendChild(newScript); } function piper(feed) { var tmp=''; for (var i=0; i<feed.value.items.length; i++) { tmp+='<a href="'+feed.value.items[i].link+'">'; tmp+=feed.value.items[i].title+'</a><br>'; if (feed.value.items[i].description) { tmp+=feed.value.items[i].description; } tmp+='<hr>'; } document.getElementById('rssLayer').innerHTML=tmp; } </script> </head> <body onLoad='getFeed("http://del.icio.us/rss/popular/javascript")'> <A HREF="" onclick='getFeed("http://reddit.com/.rss"); return false;'>Reddit</A><BR> <A HREF="" onclick='getFeed("http://del.icio.us/rss/popular/javascript"); return false;'>Delicious</A><BR> <A HREF="" onclick='getFeed("http://www.dzone.com/feed/frontpage/rss.xml"); return false;'>DZone</A><BR> <div id='rssLayer'></div> </body> </html>