How can I make text scroll in the status bar?

By default the browser determines the text that is displayed in the status bar of the browser window. For example to show the target address when the mouse cursor moves over a link.

But you change the text in the status bar with a script. The following script scrolls a message in the status bar.

Source
<SCRIPT language=JavaScript>
<!--
// Original script by Brent Plugg, adapted by Rob Schluter.
var timerId;
var msg = ""
var newMsg = ""
var counter = 0;
var nWait = 0.1
if (timerId != null) // is the timer already running?
   clearTimeout(timerId);

function pad() {
  var padding = "";
  for (var n=0; n<=(89); n++)
      padding += " ";
  return(padding);
}

function scroll() {
  window.status = newMsg.substring(counter,newMsg.length);
  if (counter == newMsg.length) {
     counter = 0;
  }
  counter ++;
  timerId = setTimeout("scroll()",nWait * 1000);
}

function startScroll(cMsgIn,nWaitIn) {
  msg = cMsgIn
  nWait = nWaitIn
  newMsg = pad() + msg + " ";
  scroll()
}
// -->
</SCRIPT>

To use the script put it in the HEAD section of the page and activate it from the BODY tag, by using the onload attribute:

Source
<BODY onload="startScroll('Your message could be here...',0.1)">

This script needs two values, first the actual message and then the time between each change in the text in seconds to control the speed of the scrolling text.

Back to the FAQ main page
Statistics

  Copyright © 1996 - 2000 Rob Schlüter,   schluter@knoware.nl   (last updated 1999/03/01)