Scrolling status bar messages

Technorealm. The UK web site design company

Free javascript

[One of a collection of free javascripts from www.technorealm.co.uk]

Here's the script for a scrolling (typewriter style) status bar display. Copy and paste it into your page inside the <HEAD> tags. Now change the message lines to suit yourself. If you don't want six lines, just put full stops on the spares.


<SCRIPT LANGUAGE = "JavaScript">
<!--
var curmes = 0
var a = 0
var counter = 0
var message = new Array()

// The following are the lines to change. Remove this line when done.
message[0] = "This is the first line."
message[1] = "You can add what you like in here."
message[2] = "Tell people about what you do, "
message[3] = "how you do it, and why you do it."
message[4] = "Then offer them something to bring them back"
message[5] = "again and again."
message[6] = "or to advise on site updates."
message[7] = "or future attractions"
message[8] = "Anything you want really"
message[9] = "Now I'm getting bored!"
message[10] = "So I'll stop!"
// DELETE OR ADD MORE MESSAGES HERE FOLLOWING ABOVE FORMAT

var temp = ""
function scrollit()
{
a = a + 1
check()
window.status = message[curmes].substring(0, a)
if(a == message[curmes].length + 10) 	// CHANGE 10 HERE IF REQUIRED
{
curmes = curmes + 1
a = 0
}
if(curmes > 10) 	// CHANGE 10 HERE IF REQUIRED
{
curmes = 0
}
counter = setTimeout("scrollit()", 80) // 80 IS SCROLL SPEED, HIGHERIS SLOWER, LOWER IS FASTER
}
function check()
{
if(a <= message[curmes].length)
{
if(message[curmes].substring(a, a + 1) == "")
{
a = a + 1
check()
}
}
}
// -->
</SCRIPT>

Now put the following text inside the <BODY> tag along with the normal attributes:

onload=scrollit()

www.technorealm.co.uk UK Web site design and graphics. A free resources site!