Creating a Scrolling Banner in status bar : StatusBar « Window Browser « JavaScript DHTML






Creating a Scrolling Banner in status bar



/*
JavaScript Bible, Fourth Edition
by Danny Goodman 

John Wiley & Sons CopyRight 2001
*/



<HTML>
<HEAD>
<TITLE>Message Scroller</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
var msg = "Welcome to my world..."
var delay = 150
var timerId
var maxCount = 0
var currCount = 1
function scrollMsg() {
    // set the number of times scrolling message is to run
    if (maxCount == 0) {
        maxCount = 3 * msg.length
    }
    window.status = msg
    // keep track of how many characters have scrolled
    currCount++
    // shift first character of msg to end of msg
    msg = msg.substring (1, msg.length) + msg.substring (0, 1)
    // test whether we've reached maximum character count
    if (currCount >= maxCount) {
        timerID = 0        // zero out the timer
        window.status = ""    // clear the status bar
        return            // break out of function
    } else {
        // recursive call to this function
        timerId = setTimeout("scrollMsg()", delay)
   }
}
// -->
</SCRIPT>
</HEAD>
<BODY onLoad="scrollMsg()">
</BODY>
</HTML>

           
       








Related examples in the same category

1.Date in the status bar
2.Displays the time in the status line
3.Write text to the window's status bar
4.Using the self Property in status bar
5.Setting the Default Status Message
6.Links with Custom Statusbar Messages
7.Handling Status Message Changes
8.JavaScript display infomation in Status Bar
9.Working with Status Bar Messages
10.Using Status Messages
11.Scrolling Text in the Status Window
12.The onFocus event Handler