Home / code / javascript / scripts

Statusbar, scroll text

Writer: Christophe Wolfs
Published: 27 March 2008

Script that lets the text scroll in the status bar. You can see the example in the statusbar below. Just copy everything and place it in the head-part.

<script language="JavaScript">
/*
Script that scrolls the text in the status bar.
Find more at http://www.webmaster2020.com
*/
// Scrolling message settings
var MessageText="Welcome to webmaster2020.com."
var DisplayLength=100
var renew=100;

var pos=1-DisplayLength;

function ScrollInStatusBar()
{
  var scroll="";
  pos++;
  if(pos == MessageText.length) pos = 1 - DisplayLength;
  if(pos<0)
  {
        for(var i=1; i<=Math.abs(pos); i++) scroll = scroll + "";
        scroll = scroll + MessageText.substring(0, DisplayLength - i + 1);
  }
  else scroll = scroll + MessageText.substring(pos, pos + DisplayLength);
  window.status=scroll;

  setTimeout("ScrollInStatusBar()",renew);
}

ScrollInStatusBar();
//-->
</script>

 

TOP