frequently ask ? : Computers : Programming : Languages : JavaScript : Windows

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

11 of 13 people (85%) answered Yes
Recently 7 of 9 people (78%) answered Yes

Entry

How can I move text in the status bar?

Aug 23rd, 2000 08:27
Martin Honnen,


Using string methods you add to or substract characters to 
  window.status;
Here is a simple example which moves in text from the left to the 
right, it should work with at least NN3+ and IE4+:
<HTML>
<HEAD>
<SCRIPT>
var msg, spd, c;
var size = 140;
function animateStatusLine (message, speed) {
  msg = message; 
  spd = speed ? speed : 20;
  c = 0;
  moveText();
}
function moveText () {
  if (c <= msg.length)
    window.status = msg.substring(msg.length - c)
  else if (c < size + msg.length)
    window.status = ' ' + window.status;
  else 
   c = 0;
  c++;
  setTimeout('moveText()', spd);
}
</SCRIPT>
</HEAD>
<BODY ONLOAD="animateStatusLine('Kibology for all.');">
</BODY>
</HTML>