Important alert: (current site time 7/15/2013 1:14:06 PM EDT)
 

VB icon

Button Ticker

Email
Submitted on: 3/16/2002 6:19:16 AM
By: Premshree Pillai  
Level: Intermediate
User Rating: Unrated
Compatibility: JavaScript
Views: 9606
 
     This is a Cross Browser Javascript Button Ticker that ticks a number of messages on a button.You can change the direction in which the message ticks. (i.e the order in which the message ticks).
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: Button Ticker
' Description:This is a Cross Browser Javascript Button Ticker that ticks a number of messages on a button.You can change the direction in which the message ticks. (i.e the order in which the message ticks).
' By: Premshree Pillai
'
' Assumes:This is a Cross Browser Javascript Button Ticker that ticks a number of messages on a button.You can change the direction in which the message ticks. (i.e the order in which the message ticks). 
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 ticker_msg and the URLs must be added to the array ticker_url. 
This ticker ticks the messages on a button. You can change the style of the button easily. 
The ticker speed can be changed easily by changing the value of the variable ticker_speed. (Here it is 1, which means that the message would change every 1 second.)
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=2747&lngWId=14'for details.'**************************************

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Button Ticker</title>
<style type="text/css">
.link{font-family:verdana,arial,helvetica; font-size:8pt; color:#3366CC; font-weight:normal}
.link:hover{font-family:verdana,arial,helvetica; font-size:8pt; color:#0099FF; font-weight:normal}
.header{font-family:arial,verdana,helvetica; font-size:20pt; color:#3366CC; font-weight:bold}
</style>
</head>
<body bgcolor="#FFFFFF">
<center>
<span class="header">Button Ticker</span>
<br>
<script language="javascript">
 
//**************************************************
// Button Ticker*
// Date created : 19 Feb, 2002 *
// (c) 2002 Premshree Pillai. All rights reserved. *
// http://www.qiksearch.com*
// premshree@hotmail.com*
// Visit http://www.qiksearch.com/javascripts.htm *
//for FREE scripts *
// Use freely as long as this message is intact*
//**************************************************
// Location : http://www.qiksearch.com/javascripts/button-ticker.htm
count=0;
var inv_button_flag=0;
if (navigator.appName=="Microsoft Internet Explorer" || (navigator.appName=="Netscape" && navigator.appVersion >= "5"))
{
document.write('<form name="qiksearch_ticker"><input type="button" name="qiksearch_ticker" onclick="goURL();" style="background:#FFFFFF; width:377; height:22; border-width:1; border-color:#000000; cursor:hand" onmouseover="this.style.background='#BDDCFF';return true" onmouseout="this.style.background='#FFFFFF';return true" onmousedown="this.style.background='#FFD543';return true"><input type="button" value="5" onclick="javascript:inv_button();inv_msg();inv_URL();" style="width:22; height:22; font-family:webdings; background:#FFFFFF; border-left-width:0; border-right-width:1px; border-top-width:1px; border-bottom-width:1px; border-color:#000000; cursor:hand" name="inv_but" title="Tick Up Direction"></form>');
}
else
{
document.write('<form name="qiksearch_ticker"><input type="button" name="qiksearch_ticker" onclick="goURL();" width="349" border="0"><input type="button" width="50" value="up" onclick="javascript:inv_button();inv_msg();inv_URL();" name="inv_but"></form>');
}
var ticker_speed=1;
 
 // Ticker messages
 var ticker_msg = new Array(
 "Welcome to Qiksearch",
 "FREE Javascripts",
 "Intellisearch Bar NOW!",
 "www.qiksearch.com",
 "FREE Articles" ); // No comma after last ticker msg
 // Ticker URLs
 var ticker_url = new Array(
 "http://www.qiksearch.com",
 "http://www.qiksearch.com/javascripts.htm",
 "http://intellisearch.cjb.net",
 "http://www.qiksearch.com",
 "http://www.qiksearch.com/articles.htm" ); // No comma after last ticker url
function tick()
{
 if(count<ticker_msg.length)
 { 
 this.document.qiksearch_ticker.qiksearch_ticker.value=ticker_msg[count];
 count++;
 if(count==ticker_msg.length)
 {
count=0;
 }
 setTimeout("tick();",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];
 }
}
function inv_button()
{
 if (navigator.appName=="Microsoft Internet Explorer" || (navigator.appName=="Netscape" && navigator.appVersion >= "5"))
 {
 if (inv_button_flag==0)
 {
this.document.qiksearch_ticker.inv_but.value="6";
this.document.qiksearch_ticker.inv_but.title="Tick Down Direction";
inv_button_flag=1;
 }
 else
 {
this.document.qiksearch_ticker.inv_but.value="5";
this.document.qiksearch_ticker.inv_but.title="Tick Up Direction";
inv_button_flag=0;
 }
 }
 else
 {
 if (inv_button_flag==0)
 {
this.document.qiksearch_ticker.inv_but.value="Down";
inv_button_flag=1;
 }
 else
 {
this.document.qiksearch_ticker.inv_but.value="Up";
inv_button_flag=0;
 }
 }
}
function inv_msg()
{
 for(var i=0;i<Math.floor(ticker_msg.length/2);i++)
 {
 var temp=ticker_msg[i];
 ticker_msg[i]=ticker_msg[ticker_msg.length-1-i];
 ticker_msg[ticker_msg.length-1-i]=temp;
 }
}
function inv_URL()
{
 for(var i=0;i<Math.floor(ticker_msg.length/2);i++)
 {
 var temp=ticker_url[i];
 ticker_url[i]=ticker_url[ticker_msg.length-1-i];
 ticker_url[ticker_msg.length-1-i]=temp;
 }
}
tick();
</script>
<table width="400" align="center" cellspacing="0" cellpadding="0"><tr><td>
<font face="verdana,arial,helvetica" size="-1" color="#000000">
This is a Cross Browser Javascript Button Ticker that ticks a number of messages on a button.You can change the direction in which the message ticks. (i.e the order in which the message ticks).
<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>This ticker ticks the messages on a button. You can change the style of the button easily.
<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 <script> 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="mailto:premshree@hotmail.com?Subject=Javascripts" class="link">© 2002 Premshree Pillai. All rights reserved.</a>
</font>
</td></tr></table>
</center>
</body>
</html>


Other 28 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
11/23/2002 6:02:27 AMJohn wessels

oh well ,another script that dont work !
copied the entire script(page) as it is.
Guess what ?
2 errors on line 44 and 191.
a warning on this site would be great !
something like "warning ,scripts are not checked !

john
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.