Mega Code Archive

 
Categories / JavaScript DHTML / GUI Components
 

Text Box Ticker

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Text Box Ticker</title> <style type="text/css"> .link{font-family:verdana,arial,helvetica; font-size:8pt; color:#808080; font-weight:normal} .link:hover{font-family:verdana,arial,helvetica; font-size:8pt; color:#FF9900; font-weight:normal} .header{font-family:arial,verdana,helvetica; font-size:25pt; color:#FF9900; font-weight:bold; filter:DropShadow(color=#000000, offX=2, offY=2, positive=1); width:100%} .TextBoxTicker{background:#FCFCFC; border:#808080 solid 1px; text-align:center; cursor:pointer} </style> </head> <body bgcolor="#FFFFFF"> <center> <span class="header">Text Box Ticker</span> <br> <script language="JavaScript"> // Text Box Ticker                       // (c) 2002 Premshree Pillai. // http://www.qiksearch.com // qiksearch@rediffmail.com document.write('<form name="qiksearch_ticker"><input type="text" class="TextBoxTicker" onfocus="goURL();this.blur();" name="qiksearch_ticker" size="55"></form>'); var count=0; var ticker_speed=1;    // Ticker messages  var ticker_msg = new Array(      "Welcome to Qiksearch",      "Download Javascripts",      "Intellisearch Bar NOW!",      "FREE Articles" ); // No comma after last ticker msg  // Ticker URLs  var ticker_url = new Array(      "http://www.qiksearch.com",      "http://www.simtel.net/pub/pd/57885.html",      "http://www.simtel.net/pub/pd/57634.html",      "http://www.qiksearch.com/articles.htm" ); // No comma after last ticker url function TextBoxTicker() {  if(count<ticker_msg.length)  {     this.document.qiksearch_ticker.qiksearch_ticker.value=ticker_msg[count];   count++;   if(count==ticker_msg.length)   {    count=0;   }   setTimeout("TextBoxTicker();",ticker_speed*1000);  } } function goURL() {  if(this.document.qiksearch_ticker.qiksearch_ticker.value==ticker_msg[ticker_msg.length-1])  {   location.href=ticker_url[ticker_msg.length-1];  }  else  {   location.href=ticker_url[count-1];  } } TextBoxTicker(); </script> <table width="400" align="center" cellspacing="0" cellpadding="0"><tr><td> <font face="verdana,arial,helvetica" size="-1" color="#000000"> This is a Javascript Text Box Ticker that ticks a number of messages on a Text Box. <br><br>This ticker is very easy to customise. You can add any number of messages and their corresponding URLs. Messages must be added to the array <font face="courier">ticker_msg</font> and the URLs must be added to the array <font face="courier">ticker_url</font>. <br><br>The ticker speed can be changed easily by changing the value of the variable <font face="courier">ticker_speed</font>. (Here it is 1, which means that the message would change every 1 second.) <br><br>To use this script, you just have to copy the &lt;script&gt; section of the source and paste it wherever you require on your web page. <br><br><hr style="width:100%; height:1; color:#000000"> <a href="http://www.qiksearch.com" class="link">&#169 2002 Premshree Pillai. All rights reserved.</a> </font> </td></tr></table> </center> </body> </html>