Jump to content

how to create javascript ticker?


Atex445

Recommended Posts

I'm still trying to find a way to add RSS to my website,i found this website (i recommend it to everyone who need RSS in his website) ---> feeddigest.comand the thing is,that its gave me the rss,but all the news in one block,her is an example:

08/01 7.2 quake strikes near Pacific island08/01 Russia to sink flag in Arctic for land grab08/01 Russia to sink flag in Arctic in oil, land grab08/01 Boys survive attack; woman, girls dead08/01 Police: Handcuffs scarred adoptees' wrists08/01 Rocky rebound on Wall Street08/01 Imports set to overtake U.S. brands08/01 Families hunt loved ones lost in institutions08/01 Whoopi Goldberg joins 'The View'08/01 Stocks on roller-coaster ride

i wonder if anyone can think of algorithm or something,that well allow we use this script:

<script type="text/javascript" src="http://app.feeddigest.com/digest3/2ZWNCRJHBC.js"><noscript><a href="http://app.feeddigest.com/digest3/2ZWNCRJHBC.html">Click for "Change Me".</a> Powered by <a href="http://www.feeddigest.com/">RSS Feed Digest</a></noscript></script>

and change it that he will show me each line of the output for 10 sec and then change to another line (like a javascript ticker)

Link to comment
Share on other sites

Is that list of headlines being returned to some javascript function or variable? If so, you could split the variable on the newline character to get an array of items. Then, using setTimeout or setInterval, you could write a function that loops through each element in the array one at a time after, say, a ten second delay.If that doesn't make sense, post what you have code-wise.

Link to comment
Share on other sites

I came up with this. I hope it helps:

<html><body><div id="HeadlineList" style="display: none;"><script src="http://app.feeddigest.com/digest3/2ZWNCRJHBC.js"></script></div><div id="Headline"></div><script type="text/javascript">var div = document.getElementById("HeadlineList");var links = div.getElementsByTagName("a");var current = 0;function showHeadline(){	if(links)	{		document.getElementById("Headline").innerHTML = "<a href='" + links[current].href + "'>" + links[current].innerHTML + "</a>";		current = (current + 1) % links.length;		setTimeout("showHeadline();", 10000);	}}showHeadline();</script></body></html>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...