|
A Status Bar Message That Scrolls Once This variation on the scrolling status bar message theme shows you how to set up a message that scrolls in once and then stops. Here's how to use it:
Here's the full script:
<SCRIPT LANGUAGE="JavaScript">
<!--
// Use the following three variables to set up the message:
var msg = "Enter your status bar message here"
var delay = 50
var startPos = 100
// Don't touch these variables:
var timerID = null
var timerRunning = false
var pos = 0
var scrolls = 0
// Crank it up!
StartScrolling()
function StartScrolling()
{
// Make sure the clock is stopped
StopTheClock()
// Pad the message with spaces to get the "start" position
for (var i = 0; i < startPos; i++) msg = " " + msg
// Off we go...
DoTheScroll()
}
function StopTheClock()
{
if(timerRunning)
clearTimeout(timerID)
timerRunning = false
}
function DoTheScroll()
{
if (pos <= startPos)
self.status = msg.substring(pos, msg.length)
else
{
StopTheClock()
return
}
++pos
timerRunning = true
timerID = self.setTimeout("DoTheScroll()", delay)
}
//-->
</SCRIPT>
Copyright © 1995-2008 Paul McFedries and Logophilia Limited |