Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Status Box Message Scroller

Posted on 1999-07-08
6
Medium Priority
?
212 Views
Last Modified: 2013-12-25
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!
0
Comment
Question by:jajr
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 9

Accepted Solution

by:
TTom earned 400 total points
ID: 1863884
jajr:

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.

<HTML>
<HEAD>
<TITLE>
Configurable Text Scroller by James Keiger
</TITLE>
</HEAD>
<BODY BGCOLOR=WHITE TEXT=BLACK>

<SCRIPT LANGUAGE="JavaScript">
// 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.substring(0,scroll.length-1);
      }
      scroll = temp;
      doScroll();
}

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

// Uncomment this to start scroller as soon as JavaScript is
// loaded instead of full body
// doScroll();
</SCRIPT>
<BODY onLoad="doScroll()">
<FORM NAME="scroller">
<H4>Scroll controls<BR></H4>
<INPUT TYPE="TEXT" SIZE=40 NAME="text"><BR>
<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
Direction"><BR>
<INPUT TYPE="BUTTON" onClick="scrollstatus = ! scrollstatus;" VALUE="Status
Line Scroll Start/Stop">
<INPUT TYPE="BUTTON" onClick="scrolltext = ! scrolltext;" VALUE="Text Field
Scroll Start/Stop">
</FORM>
</BODY>
</HTML>

Tom
0
 
LVL 18

Expert Comment

by:mgfranz
ID: 1863885
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?

Mark
0
 
LVL 9

Expert Comment

by:TTom
ID: 1863886
mgf:

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>).

Tom
0
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
LVL 18

Expert Comment

by:mgfranz
ID: 1863887
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) {
count(DoScroll())
}


0
 
LVL 9

Expert Comment

by:TTom
ID: 1863888
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>

Tom
0
 

Author Comment

by:jajr
ID: 1863889
Thank you very much!
0

Featured Post

Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Because your company can’t afford for you to make SEO mistakes, you’ll want to ensure you’re taking the right steps each and every time you post a new piece of content. This list of optimization do’s and don’ts can help you become an SEO wizard.
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question