Scrolling Text

form input method and the status bar method

in a form input box

In this form two variables are being set up to run in the input box.

  1. space
  2. scr

The next thing done was the naming of the function. The name can be anything you wish. You reference the script from your page using this name and the parenthesis.

The other item you can change in this script is the speed at which the scroll effect works. In this script it is set at 200. This is measured in thousandths of a second. In other words, the text will move one letter to the left five times a second. At 20 the text would move ten times faster. Adjust to your own taste.

<script language="javascript" type="text/javascript"><!--

var space = "             "
var scr = space + "This text is scrolling in the form..."

function ScrollingAlong()
{
temp = scr.substring(0,1);
scr += temp
scr = scr.substring(1,scr.length);
document.Scroll.ScrollBox.value = scr.substring(0,55);
var counts = setTimeout("ScrollingAlong()",200);
}

// --></script>

Place the script above in the head of the document.
Place this in the body tag. onLoad="ScrollingAlong()"
When the page loads it will fire the script.
And last, place the form below (without changes) in the body where you want the scroll message to appear.

<form name="Scroll">
<input type="text" size="25" name="ScrollBox" value=" ">
</form>

That's it! You are done.


in the status bar

In this example two variables are being set up to run in the status bar at the bottom of the window.

Space is set up as before. The second variable I called woids. You can name the variable almost anything you wish. Best to keep it unique. Place your message between the quotes as before. Adjust the speed of the scrolling effect.

Next, place the script in the head of the document.

Once again, place this in the body tag onLoad="ScrollingAgain()"
When the page loads it will fire this script.
You can put multiple calls in the body tag as I have done for this page
onLoad="ScrollingAlong(),ScrollingAgain()"
Both scripts fire when the page loads. Just use a comma to seperate the function names.

Unlike the script above, you do not need to place anything in the document field. The reason? The message appears in the window status bar and not a document.object

<script language="javascript" type="text/javascript"><!--

var space = " "
var woids = space + "Jesus is the Christ, the Son of the Living God..."

function ScrollingAgain()
{
temp = woids.substring(0,1);
woids += temp
woids = woids.substring(1,woids.length);
window.status = woids.substring(0,55);
var counts = setTimeout("ScrollingAgain()",200);
}

// --></script>


Hope that this helps you...

Author: Joseph Raymond

27th of March, 2001