#fcleft">



This is one of the most popular banner scripts, but until now, I had not been able to figure out how to "shrink" the code. This script slides each letter of the message onto the statusbar. I have equiped it to display multiple messages and to skip sliding the spaces.
The source..


<script language="Javascript">
<!--
// please keep these lines on when you copy the source
// made by: Nicolas - http://www.javascript-page.com

function initArray(n) {
  this.length = n;
  for (var i =1; i <= n; i++) {
    this[i] = ' '
  }
}

slide = new initArray(4)
slide[0]="This is Message 1"
slide[1]="Now it is Message 2"
slide[2]="No, do not say I have to do 3 messages"
slide[3]="Yea, this message, 4, is the last message (and it's long)"

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>


Color coding..


The number "3" represents the wait in milliseconds between the "sliding" of one space of each character in the message list. Anywhere between "2" and "10" would be fine for the average webpage
The number "3000" represents the number of milliseconds between the changing of each message (2 seconds, here). Anywhere between "1500" and "5000" would be fine for the average webpage.
This is the number of different messages you have. The different messages are stated by slide[the number in line -1]="The message" so you can add or subtract the number of messages in the list by knowing this.
You can change this script to display on a form instead of the statusbar by making a form input and changing "window.status" to "document.form_name.input_name.value".