1. Technology
Send to a Friend via Email

Cross Browser Ticker/Marquee

1. Introduction and Sample

Internet Explorer introduced a proprietary tag <marquee> to allow horizontally scrolling text to be added to a web page. While some other browsers have also added support for this tag it is still not recognised by all modern browsers and also the things that you can do with the tag are very limited.

By replacing the proprietary tag with an ordinary <div> and a few lines of Javascript we can produce some horizontally scrolling text that is at least as flexible in how it can be configured as the proprietary tag is and which will also work on any recent Javascript enabled browser (IE5+, Netscape 6+, Opera 7+, Firefox, etc.). It also has the added advantage that you can validate your HTML and not get an error because of your having used a proprietary tag.

Here is an example ticker (or marquee) that scrolls from right to left (RtoL).

The script allows you to not only change the content of the scrolling text to include anything you like (as long as it doesn't need more than the height of one line of text to display it), you can also change the width and height of the area, the font to be used, the background colour, the speed of the scroll, and whether or not it should stop scrolling when you move the mouse over it. If this effect is one you want for your page then the next step is to obtain the Right to Left script or Left to Right script (depending on which way you want the text to scroll).

©2014 About.com. All rights reserved.