Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > dynamicaly parsing a RSS feed to a newsticker applet.

Reply
Thread Tools

dynamicaly parsing a RSS feed to a newsticker applet.

 
 
Shogan
Guest
Posts: n/a
 
      07-22-2005
I stumbled on this capability of javascript by accident.
here's the applet I'm using:
http://javaboutique.internet.com/AdvNewsticker/

feel free to modify to code to apply this capability to any other
method of display you feel like.

and here's the code to do the parsing for the applet.

<HEAD>
<script type="text/javascript">
function RSStoapplet(){

var iMax = 20

var rssDoc = new ActiveXObject("Microsoft.XMLDOM")
rssDoc.async = false
rssDoc.load("YourRSSFeed.xml")

var headNode = rssDoc.selectNodes("/rss/channel")
var itemNodes = rssDoc.selectNodes("/rss/channel/item")

if(itemNodes.length<iMax){
iMax = itemNodes.length
}

document.writeln("<p><center><font color=\"FFFF00\">" +
headNode.item(0).getElementsByTagName("title").ite m(0).text +
"</font></center></p>");
document.writeln("<applet
code=\"http://javaboutique.internet.com/AdvNewsticker/advnewsticker.class\"
width=\"100%\" height=\"27\">");
document.writeln("<param name=\"regcode\" value=\"\">");
document.writeln("<param name=\"info\" value=\"Applet by Gokhan
Dagli,www.appletcollection.com\">");
document.writeln("<param name=\"input_text\"
value=\"from_parameters\">");
document.writeln("<param name=\"text_file\" value=\"\">");
document.writeln("<param name=\"bgcolor\" value=\"000000\">");
document.writeln("<param name=\"text_color\" value=\"FFFF00\">");
document.writeln("<param name=\"highlight_text_color\"
value=\"4876FF\">");
document.writeln("<param name=\"font_type\" value=\"Arial\">");
document.writeln("<param name=\"font_size\" value=\"14\">");
document.writeln("<param name=\"font_style\" value=\"0\">");
document.writeln("<param name=\"underline\" value=\"no\">");
document.writeln("<param name=\"border_thickness\" value=\"1\">");
document.writeln("<param name=\"border_color\" value=\"000000\">");
document.writeln("<param name=\"highlight_border_color\"
value=\"000000\">");
document.writeln("<param name=\"text_align\" value=\"center\">");
document.writeln("<param name=\"xoffset\" value=\"5\">");
document.writeln("<param name=\"yoffset\" value=\"0\">");
document.writeln("<param name=\"pause_time\" value=\"5000\">");
document.writeln("<param name=\"hscroll_delay\" value=\"8\">");
document.writeln("<param name=\"vscroll_delay\" value=\"30\">");
document.writeln("<param name=\"typewriter_delay\" value=\"30\">");
document.writeln("<param name=\"fade_delay\" value=\"100\">");
document.writeln("<param name=\"effects\" value=\"custom\">");
document.writeln("<param name=\"custom_in_effects\" value=\"1\">");
document.writeln("<param name=\"custom_out_effects\" value=\"1\">");
for(i=0;i<iMax;i++){
document.writeln("<param name=\"text" + (i+1) + "\" value=\"" +
itemNodes.item(i).getElementsByTagName("title").it em(0).text + "\">");
document.writeln("<param name=\"link" + (i+1) + "\" value=\"" +
itemNodes.item(i).getElementsByTagName("link").ite m(0).text + "\">");
document.writeln("<param name=\"target_frame1\" value=\"_blank\">");
}
document.writeln("</applet>");
document.writeln("<FORM>");
document.writeln("<div align=\"center\">");
document.writeln("<INPUT TYPE=\"button\" class=\"buttonStyle\"
onClick=\"history.go(0)\" VALUE=\"Reload Page\">");
document.writeln("</div>");
document.writeln("</FORM>");
document.writeln("</body></html>");
}
</script>
</HEAD>
<body bgcolor=000000 onload="setTimeout('history.go(0)',300000);">
<script type="text/javascript">
RSStoapplet();
</script>
</body>


I am having javascript dynamicaly create the html code for the applet
call to include the text into the applet.
Note also that I am refreshing the page every 5 minutes so the news
doesn't get stale.

the code to pull the rss feed and manipulate it came from:
http://www.howtodothings.com/ViewArt...spx?Article=74

this also works but I think mine looks prettier. (sorry if you don't
like the colour scheme)

have fun with this.

Shogan

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Two ways to generate RSS - rss/maker and rss/2.0 - which is better? Jonathan Groll Ruby 1 06-27-2009 03:53 AM
kiddy question about newsticker snippet R.P. Javascript 4 11-17-2008 08:46 PM
Post RSS feed w/o RSS-to-Javascript.com Scott Gordo HTML 5 08-29-2006 01:34 AM
RSS Feed - need an Idiot's Guide to RSS News on my website teach_me6@hotmail.com HTML 5 02-25-2005 11:01 AM
Searches in multiple RSS feeds -> new rss feed Motta XML 1 06-09-2004 10:55 PM



Advertisments