Post by -wiz- on Feb 11, 2004 14:00:59 GMT -5
this will scroll text at the bottom of the page like on the main bgoat site page.
<script LANGUAGE="JavaScript">
<!--
// Use the following variable to specify
// the number of messages
var NumberOfMessages = 8
var messages = new BuildArray(NumberOfMessages)
// Use the following variables to
// define your messages:
messages[1] = "message"
messages[2] = "message"
messages[3] = "message"
messages[4] = "message"
messages[5] = "message"
messages[6] = "message"
messages[7] = "message"
messages[8] = "message"
var delay = 70
var startPos = 100
// Don't touch these variables:
var timerID = null
var timerRunning = false
var pos = 0
var msgNumber = 0
// Crank it up!
StartScrolling()
function StartScrolling(){
// Make sure the clock is stopped
StopTheClock()
// Pick the first message
PickNextMessage()
// Off we go...
DoTheScroll()
}
function StopTheClock(){
if(timerRunning)
clearTimeout(timerID)
timerRunning = false
}
function DoTheScroll(){
if (pos <= msg.length)
self.status = msg.substring(pos, msg.length);
else{
PickNextMessage()
pos=-1
}
++pos
timerRunning = true
timerID = self.setTimeout("DoTheScroll()", delay)
}
function PickNextMessage(){
// Calculate the next message
msgNumber = (msgNumber++ % messages.length) + 1
msg = messages[msgNumber]
// Pad the message with spaces to get the
// "start" position
for (var i = 0; i < startPos; i++) msg = " " + msg
}
function BuildArray(size){
this.length = size
for (var i = 1; i <= size; i++){
this = null}
return this
}
//-->
</SCRIPT>
all you have to do is add your messages where it says messages. if you add a new message or take away a message make sure to change the number where it says var NumberOfMessages = 8 in the top part of the script to how ever many messages you have.
<script LANGUAGE="JavaScript">
<!--
// Use the following variable to specify
// the number of messages
var NumberOfMessages = 8
var messages = new BuildArray(NumberOfMessages)
// Use the following variables to
// define your messages:
messages[1] = "message"
messages[2] = "message"
messages[3] = "message"
messages[4] = "message"
messages[5] = "message"
messages[6] = "message"
messages[7] = "message"
messages[8] = "message"
var delay = 70
var startPos = 100
// Don't touch these variables:
var timerID = null
var timerRunning = false
var pos = 0
var msgNumber = 0
// Crank it up!
StartScrolling()
function StartScrolling(){
// Make sure the clock is stopped
StopTheClock()
// Pick the first message
PickNextMessage()
// Off we go...
DoTheScroll()
}
function StopTheClock(){
if(timerRunning)
clearTimeout(timerID)
timerRunning = false
}
function DoTheScroll(){
if (pos <= msg.length)
self.status = msg.substring(pos, msg.length);
else{
PickNextMessage()
pos=-1
}
++pos
timerRunning = true
timerID = self.setTimeout("DoTheScroll()", delay)
}
function PickNextMessage(){
// Calculate the next message
msgNumber = (msgNumber++ % messages.length) + 1
msg = messages[msgNumber]
// Pad the message with spaces to get the
// "start" position
for (var i = 0; i < startPos; i++) msg = " " + msg
}
function BuildArray(size){
this.length = size
for (var i = 1; i <= size; i++){
this = null}
return this
}
//-->
</SCRIPT>
all you have to do is add your messages where it says messages. if you add a new message or take away a message make sure to change the number where it says var NumberOfMessages = 8 in the top part of the script to how ever many messages you have.