Webmaster Resources Center

Welcome to the Bravenet Resource Center. Use these resources to help make your web pages more advanced and fun to use.

Articles & Tutorials

Get a Horizontally Scrolling Message on Your Website

by Bravenet.com


Summary :

How would you like a horizontally scrolling message on your webpage? With this easy script, you can have a horizontally scrolling message on your website in just minutes!

This little script will make that possible. Simply copy all the contents of this box and paste it into the head section of your webpage. <script language="javascript">
<!--
var bannerID=0
function text(msg,ctrlwidth) {
msg = " --- "+msg
newmsg = msg
while (newmsg.length < ctrlwidth) {
newmsg += msg
}
document.write ('<FORM NAME="Scrolltext">');
document.write ('<CENTER><INPUT NAME="text" VALUE= "'+newmsg+'" SIZE= '+ctrlwidth+' ></CENTER>');
document.write ('</FORM>');
var bannerID = null
rollmsg()
}
function rollmsg() {
NowMsg = document.Scrolltext.text.value
NowMsg = NowMsg.substring(1,NowMsg.length)+NowMsg.substring(0,1)
document.Scrolltext.text.value = NowMsg
bannerID = setTimeout("rollmsg()",100)//change the number 100 to represent the speed of the scroll. The larger the number the slower it moves
}
// -->
</script>

Then copy the contents of this box and paste it into the body of your webpage at the point where you would like the scrolling message to appear. You can modify the text in this area to reflect the message that you would like to have scrolling by.

<script>
<!--
msg = " You can create any message that you want. Put it in here. and it will continue to scroll by for your visitors to see. That's all there is to it. "
ctrlwidth = "75" //change this number to the length you would like the message box to be
text(msg,ctrlwidth);
// -->
</script>

Enjoy!