JavaScript Scroll

This page contains code that you can use to create a JavaScript scroll. This is a JavaScript marquee that displays scrolling text. The text scrolls in any direction you need; horizontally (from right to left, left to right), or vertically (down to up, or up to down). The JavaScript scroll was originally created by Netscape and is distributed using the Mozilla Public License. It should work on most browsers.

This JavaScript scrolling script comes in two parts: The first part is an external .js file, which contains the scrolling text code. The second part is the customizable part, where you enter your own parameters.

Here are some samples, just to get you started.

Instructions

First of all, download xbMarquee.js.

If you prefer not to download the file, you can copy/paste the contents into a file (see bottom of this article).

Once you've done that, you can use any of the following codes to display your JavaScript scroller. These codes simply provide the parameters for the xbMarquee.js file. These parameters determine things such as the scroll direction, the text to scroll, the speed of the marquee etc. You only need to reference xbMarquee.js once on any page that uses the code (regardless of how many marquees are on that page).

Right to Left

This marquee scrolls from right to left.

Example:

Left to Right

This text scrolls from left to right.

Example:

Faster

This text scrolls from right to left, but much faster than the previous examples.

Example:

Scrolling Up

This text scrolls upwards. The height of the marquee has changed too - from 29px to 200px.

Example:

Scrolling Down

This text scrolls downwards.

Example:

Contents of xbMarquee.js

Below are the full contents of xbMarquee.js. You will need this for the above marquee examples to work.