• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 222
  • Last Modified:

Status Box Message Scroller

I need a javascript to run a brief message in the Status Box. Want it to scroll by twice, no more, when the page is activated.  Have found several that scroll endlessly, which is overkill. Don't want it on the main screen, just down in the little box. Thanks!
  • 3
  • 2
1 Solution

Here is a configurable scroller script which I found on www.developer.com.

The only thing I did to it was to set a timeout value for 10 seconds ("setTimeout('ok = false', 10000)").  You should be able to adjust this for any acceptable value you decide upon.  I had thought about calculating the time based on the length of the message.  That should not be all that difficult to do.

Obviously, you will need to pull out only the portions of code which will do what you need.

Configurable Text Scroller by James Keiger

// Configurable Text Scroller
// Please feel free to discribute but include these two lines:
// (C) 1997 James Keiger
// E-mail comments, solutions, praises, and please
// let me know if you use this script
// james@gti.net

// Pad this with spaces if you want to create the effect of a large
// scroll area.  If you are using the textfield, remember to make sure
// the length of this string is the same as the size of the textfield

var scroll = "JavaScroller                           ";

// Uncomment and copy this line if you want a longer message
// scroll = scroll + " more text goes here";

var ok = true;                  // tells whether to scroll or not

                              // if set to false here, scroller does

                        // not start on page load

var scrollstatus = true;      // if this is true, scrolling occurs
                        // on the status line

var scrolltext = true;            // if this is true, scrolling occurs

                        // in the text field

// To do the above with checkboxes, try using
// document.scroller.checkboxname.checked instead of those variables

var delay = 100;            // delay (in milliseconds)
                        // between successive letter movements

var delta = 10;                  // amount (in milliseconds) to increase
                        // or decrease if slower/faster is clicked

var lefttoright = false;      // set to false if you want to scroll

                        // right to left

function doScroll() {
      if (ok) {
            setTimeout("scroller()", delay);
            setTimeout("ok = false", 10000);

function scroller() {
      var temp;
      if (scrollstatus) {
            this.status = scroll;
      if (scrolltext) {
            document.scroller.text.value = scroll;
      if (lefttoright) {
            temp = scroll.substring(1,scroll.length) + scroll.substring(0,1);
      } else {
            temp = scroll.charAt(scroll.length-1) +
      scroll = temp;

function st() {
      ok = (! ok);

// Uncomment this to start scroller as soon as JavaScript is
// loaded instead of full body
// doScroll();
<BODY onLoad="doScroll()">
<FORM NAME="scroller">
<H4>Scroll controls<BR></H4>
<INPUT TYPE="BUTTON" onClick="st();" VALUE="Start/Stop">
<INPUT TYPE="BUTTON" onClick="delay += delta;" VALUE="Slower">
<INPUT TYPE="BUTTON" onClick="delay -= delta;" VALUE="Faster">
<INPUT TYPE="BUTTON" onClick="lefttoright = ! lefttoright;" VALUE="Change
<INPUT TYPE="BUTTON" onClick="scrollstatus = ! scrollstatus;" VALUE="Status
Line Scroll Start/Stop">
<INPUT TYPE="BUTTON" onClick="scrolltext = ! scrolltext;" VALUE="Text Field
Scroll Start/Stop">

Hmmm... does this scroller begin after the page has been loaded, or during?  My thinking is if there is a lot of stuff to load, the scroller might time-out before the page finishes.

Have you concidered using an applet?


I think this particular scroller has the option to begin either when it is loaded or 'onload' of the doc.  In any case, it would be a trivial matter to make it start when the doc loaded.  Seems to me that an applet would be a lot more trouble than it's worth just to 'timeout' a scrolling statusbar message.

The only reason there is so much code above is that this is a generic script to show possibilities.  The actual code needed for what jajr wants to do probably amounts to about five lines.  I just didn't want to extract and debug (because I always get it wrong when I start cutting up other peoples' work <G>).

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

I just saw the last portion of the script where it is 'onload' enabled... my mistake.

Another thought, instead of a timeout, how about setting up a count for DoScroll()

count = 0
while (count < 2) {

Would probably work, and might be an even better solution, although it might take 2 or 3 lines of code, instead of just 1 <G>

jajrAuthor Commented:
Thank you very much!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now