marquee tag to produce the desired effect.
marquee tagmarquee tag might be a good way to go. Adding scrolling text to a document is as easy as typing it between opening and closing marquee tags, as the following example shows:
Microsoft's
scrolling text with Microsoft's marquee tag This text appears above the marquee. This text appears below the marquee.
marquee tag has a variety of useful properties that can be set to control the appearance of the marquee. For more information on these properties, the interested reader is referred to Microsoft's documentation on this tag.
Although Microsoft's marquee tag is a very attractive solution (both in visual appeal and in ease of programming), it is important to understand that it is only supported in Microsoft's Internet Explorer. Frankly put, the marquee tag is a "proprietary gadget extension" to HTML, so there is a chance that Netscape Communications and other browser manufacturers will never support it in their browsers. Because of this, we recommend that you do not use marquee unless your target audience consists solely of web surfers who use Microsoft's proprietary browser.
Here is a brief summary of some of the parameters appearing in this JavaScript code:
<html> <head> <title>scrolling text with JavaScript and forms</title> <script> message = "This is a scrolling marquee message."; initial_delay = 0; scroll_delay = 75; max_indent = 50; function scroll () { message = message . substring (1, message . length) + message . substring (0, 1); document . scrollbox_form . scrollbox . value = message; window . setTimeout ("scroll ()", scroll_delay); } function start_scroll () { for (var i = 1; i <= max_indent; i ++) message = " " + message; scrollbox = document . scrollbox_form . scrollbox; window . setTimeout ("scroll ()", initial_delay); } </script> </head> <body onLoad="start_scroll ();"> This text appears above the marquee. <form name=scrollbox_form> <input type=text name=scrollbox size=25> </form> This text appears below the marquee. </body> </html>
body tag's onLoad event.
start_scroll function, which performs the following actions:
scroll function is automatically called after initial_delay milliseconds.
start_scroll function, the browser idles until the timeout period expires.
scroll function, which performs the following actions:
substring method and some simple "string arithmetic" to rotate the message string by one character.
scroll function will again be executed after scroll_delay milliseconds.
scroll function, the browser idles until the new timeout period expires.
scroll function as indicated in step 5, and the process repeats itself until an external event causes the JavaScript interpreter to stop.
substring method, the setTimeout method, and the onLoad event handler can be obtained from Netscape Communication's JavaScript Guide.
Charlton Rose
Nov. 4, 1996