JavaScript Ticker

Written by admin on December 26, 2008 – 7:30 am -

This script provides a nice, clean ticker for all your messages, news headlines, etc. IE only.
Author: Premshree Pillai (premshree@hotmail.com)

<!-- ONE STEP TO INSTALL JAVASCRIPT TICKER 1.2:

  1.  Copy the coding into the HEAD of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
window.onerror = null;
 var bName = navigator.appName;
 var bVer = parseInt(navigator.appVersion);
 var NS4 = (bName == "Netscape" && bVer >= 4);
 var IE4 = (bName == "Microsoft Internet Explorer"
 && bVer >= 4);
 var NS3 = (bName == "Netscape" && bVer < 4);
 var IE3 = (bName == "Microsoft Internet Explorer"
 && bVer < 4);
 var i=0;

// Change the position of the ticker
 var top_pos = 275;
 var left_pos = 200;

// Change the speed of the ticker (in milliseconds)
 var time_length = 2000;

 var div_name = "qiksearch";

// Enter messages for the ticker
 var ticker_msg = new Array(
     "Welcome to the JavaScript Source",
     "Check out our new scripts!",
     "You can also find them by name",
     "Check out tutorials",
     "or check out other scrolls" );

// Enter the URL's for the above messages
 var ticker_url = new Array(
     "http://javascript.internet.com/",
     "http://javascript.internet.com/new/",
     "http://javascript.internet.com/master-list/",
     "http://javascript.internet.com/tutorials/",
     "http://javascript.internet.com/scrolls/" );

var ticker_len = ticker_msg.length;
for(var l=0; l<ticker_len; l++)
{
document.write('<div id="' + div_name + l + '" style="position:absolute; visibility:hidden; top:' + top_pos + '; left:' + left_pos + '">' + '<table bgcolor="#000000" cellspacing="0" cellpadding="1" width="400"><tr><td><table width="100%" bgcolor="#EFEFEF"><tr><td><center><a href="' + ticker_url[l] + ‘” class=”tick”>’ + ticker_msg[l] + ‘</center></a></td>’);
document.write(’</tr></table></td></tr></table>’ + ‘</div>’);
}
if (NS4 || IE4) {
 if (navigator.appName == “Netscape”) {
 layerStyleRef=”layer.”;
 layerRef=”document.layers”;
 styleSwitch=”";
 }else{
 layerStyleRef=”layer.style.”;
 layerRef=”document.all”;
 styleSwitch=”.style”;
 }
}
//SCROLL
function tick(){
if (NS4 || IE4) {
 if(i<ticker_len)
 {
  if(i==0)
  {
   eval(layerRef+’["'+div_name+(ticker_len-1)+'"]‘+
   styleSwitch+’.visibility=”hidden”‘);
  }
  if(i>0)
  {
   eval(layerRef+’["'+div_name+(i-1)+'"]‘+
   styleSwitch+’.visibility=”hidden”‘);
  }
 eval(layerRef+’["'+div_name+i+'"]‘+
 styleSwitch+’.visibility=”visible”‘);
 }
 if(i<ticker_len-1)
 {
 i++;
 }
 else
 {
 i=0;
 }
 setTimeout(”tick()”,time_length);
 }
}
tick();
//  End –>
</script>

<!– Script Size:  2.98 KB –>

Tags:
Posted in Scrolls |

Post a Comment