How to show scrolling banner in status bar

These 4 messages will run from one side to another in webpage
 


<SCRIPT language=Javascript>
<!--
function initArray(n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '
  }
}

slide = new initArray(4)
slide[0]="Type your first message here"
slide[1]="Type your second message here"
slide[2]="Type your third message here"
slide[3]="Type your fourth message here"

var delay1 = 3
var delay2 = 3000

var text = slide[0] + " "
var str = " "
var leftmsg = ""
var nextmsg = 0

function setMessage() {

if (str.length == 1) {

while (text.substring(0, 1) == " ") {

leftmsg += str
str = text.substring(0, 1)
text = text.substring(1, text.length)
}

leftmsg += str    
str = text.substring(0, 1)
text = text.substring(1, text.length)

for (var x = 0; x < 120; x++) {
str = " " + str
}
}

else {
str = str.substring(10, str.length)
}

window.status = leftmsg + str

if (text == "") {

str = " "
nextmsg++

if (nextmsg > slide.length) {
nextmsg = 0
}

text = slide[nextmsg] + " "
leftmsg = ""

setTimeout('setMessage()',delay2)
}

else {
setTimeout('setMessage()',delay1)
}
}

setMessage();
//-->
</SCRIPT>



Note:
1. To remove all formatting, copy/paste the code in Notepad first, then into webpage
2. Find <head> and  </head> tag in webpage code, paste between them
3. Modern browsers will not support this code

Popular posts from this blog

Basic Math Calculator

Beautify JavaScript and jQuery Code

Image to Base64 Converter

How to take Screenshot ?

Megapixels vs DPI : How to buy a good camera?