JS

JavaScript Demos:
Typing Marquee (Non-scrolling).

jim.cerny@unh.edu   13-AUG-1998



Discussion.

This example is from the Infohiway site's Cut-N-Paste JavaScript examples. It is a variation on a message marquee, in this case trying to reduce system overhead by typing out one or more messages a character at a time instead of scrolling a whole message horizontally.

Things you can set in the script:

  • This example is set to display four messages. You can change the number of messages and the text.
    Default text: "Click button to start or stop ..."
    One: "Message number one goes here."
    Two: "Message number two goes here."
    Three: "Message number three goes here."
    For example, you might want to have the initial text just blank.
  • Start typing marquee automatically (true or false):
    var start_automatically = false;
    There is a START/STOP button to the right of the message area. Whenever you stop the message it reverts to the default text and when restarted it starts with the first message, not where it left off in the loop.
  • Repeat loop of all messages (true or false):
    var marq_repeat = false;
  • Length of marquee box (in characters):
    var marq_length = 35;
  • Typing speed (175 milliseconds recommended):
    var type_speed = 175;
  • Delay between messages (2000 milliseconds recommended):
    var intermsg_delay = 2000;

The script is broken into two sections, each delimited by a pair of SCRIPT ... /SCRIPT tags. The bulk of the code, that does most of the work, is in the HTML HEAD section. A smaller piece of code, that formats the HTML Form for the marquee, is in the HTML BODY section and is placed where you want the marquee to appear relative to the rest of the page.