Important alert: (current site time 7/15/2013 1:00:43 PM EDT)
 

VB icon

A Status Bar Scroller

Email
Submitted on: 6/1/1998
By: Found on the Web 
Level: Not Given
User Rating: By 3 Users
Compatibility: JavaScript
Views: 29405
 
     A scroller is text which scrolls on the status bar of the browser. Scrollers are very popular with JavaScript authors (esp. newbies like ourselves) and equally unpopular with the rest of the Web community. (Found at:A beginner's guide to Javascript:http://www.geocities.com/SiliconValley/Park/2554/scroller.html)
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: A Status Bar Scroller
' Description:A scroller is text which scrolls on the status bar of the browser. Scrollers are very popular with JavaScript authors (esp. newbies like ourselves) and equally unpopular with the rest of the Web community. (Found at:A beginner's guide to Javascript:http://www.geocities.com/SiliconValley/Park/2554/scroller.html)
' By: Found on the Web
'
' Assumes:How much programming does it take to create a scroller? Twenty lines, to be exact, as you will see. But before we go into the code, let us understand what features of JavaScript makes the scroller possible.
First is the ability to write to the status bar using the window.status property like this:
window.status = "This will appear in the status bar"
The second is the setTimeout() function. This function takes two parameters. The first is a string specifying the JavaScript statement to be executed on triggering and the second is a number specifing time in milliseconds after which triggering occurs.
Our scroller is essentially a function which, on each invocation, moves the text on the scroll bar a little to the left and then calls setTimeout() to invoke itself after a small interval of time.
The only other function we use is substring() which is a method of the string object. If name="JavaScript", then name.substring(4,9) will return "Script". You get the general idea, right?
'**************************************

<SCRIPT LANGUAGE="JavaScript">
<!-- Start of scroller script
var scrollCounter = 0;
var scrollText= "Any text here";
var scrollDelay= 70;
var i = 0;
while (i ++ < 140)
	scrollText = " " + scrollText;
function Scroller()
{
	window.status = scrollText.substring(scrollCounter++, 
			scrollText.length);
	if (scrollCounter == scrollText.length) 
	scrollCounter = 0;
	setTimeout("Scroller()", scrollDelay);
}
Scroller();
// End of scroller script -->
</SCRIPT>
		


Other 219 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 Not Given 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
8/24/1999 5:29:00 AMNAFIZ

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

 
10/17/2000 2:44:25 PMRick Hazlett

Hello, I was wondering if I could use this code for a Interactive Yearbook that will be distributed to students in our school. Email me. ZeroZXS@hotmail.com, thanks!
(If this comment was disrespectful, please report it.)

 
7/17/2006 1:50:19 AMjaved

your project codes are excellent
please send me all the codes by mail
my email-id is javedahmed_86@rediffmail.com
(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.