NEWS TICKER
This script has been tested on and shown to work with Internet Explorer 5+, Netscape 6+, Firefox 1.0 and Opera 7+.
29-Feb-2004
: First release.
STEP 1:
Copy and paste the code below so that it sits between the <head> and </head> tags at the top of your web-page:
<script type="text/javascript"> // <![CDATA[ var news=Array("This is the NEWS-TICKER TEXT EFFECT", "Brought to you by the good people at www.mf2fm.com/rv", "Did you note how the web-address was turned into a hyperlink?", "Another free effect - "+String.fromCharCode(169)+"2004-5 RV's free DHTML effects", "Check back from time to time to get the latest scripts..."); var cursor="_"; // set cursor var delay=12; // seconds between each news item /***************************\ * News Ticker Text Effect * *(c) 2004-6 mf2fm web-design* * http://www.mf2fm.com/rv * * DON'T EDIT BELOW THIS BOX * \***************************/ var newsp, cursp, flash, item=0; window.onload=function() { if (document.getElementById) { var span=document.getElementById("news"); while (span.childNodes.length) span.removeChild(span.childNodes[0]); delay*=1000; newsp=document.createElement("span"); cursp=document.createElement("span"); cursp.appendChild(document.createTextNode(String.fromCharCode(160)+cursor)); span.appendChild(newsp); span.appendChild(cursp); ticker(); }} function ticker() { var i; while (newsp.childNodes.length) newsp.removeChild(newsp.childNodes[0]); newsp.appendChild(document.createTextNode(news[item].substring(0,1))); for (i=1; i<news[item].length; i++) setTimeout('newsp.firstChild.nodeValue="'+news[item].substring(0, i+1)+'"', 100*i); if (news[item].indexOf("www")!=-1) setTimeout('linkit('+item+')', 100*i); setTimeout('flash=setInterval("cursp.style.visibility=(cursp.style.visibility==\'visible\')?\'hidden\':\'visible\'", 234)', 100*i) setTimeout('clearInterval(flash)', delay); setTimeout('cursp.style.visibility="visible"', delay); setTimeout('ticker()', delay); item=++item%news.length; } function linkit(q) { var a,p,e,l; p=news[q].indexOf("www"); e=news[q].indexOf(" ", p); if (e==-1) e=news[q].length; l=news[q].substring(p, e); while (newsp.childNodes.length) newsp.removeChild(newsp.childNodes[0]); newsp.appendChild(document.createTextNode(news[q].substring(0, p))); a=document.createElement("a"); a.href="http://"+l; a.appendChild(document.createTextNode(l)); newsp.appendChild(a); newsp.appendChild(document.createTextNode(news[q].substring(e))); } // ]]> </script>
CLICK HERE
to select the above script ready to paste it into your clipboard
STEP 2:
Edit the array called 'news' at the start of the JavaScript to contain the messages which you want to appear. Enter links without the 'http://' but with the 'www.'
STEP 3:
Place a <span> element with 'id="news"' on your web-page containing some text which will show in case the script doesn't run (i.e. for people without JavaScript enabled). For example:
THAT'S IT
When your page loads, the text you placed in the array at the start of the script will be typed out as if it were coming from a news feed.
No menu on the left?
Click here
for a full list of all the free DHTML and Javascript effects you could be using on your web-site!
If you like my Text and Graphic Effects,
please rate them @
ScriptSearch.com
!
- Select -
Excellent!
Very Good
Good
Fair
Poor
[ This page viewed 100 times. Last viewed Thu 11 Mar, 2010 at 19:52 ]