CSS font stacks & developer FAQs with Web standards
Site navigation below

One of hundreds of answers available with our premium content service.

Part answer, see below for more

A: The script below has a number of global variables to set the basic configuration for the div element below with an id attribute marquee. This provides an identifier for the DOM getElementById() method to obtain a reference to the marquee container element. The scrollMarquee() function then uses the element node's firstChild property to get a reference to the text content of the div and its nodeValue sub-property, which is the text itself. The function then “nibbles” the first character off the start of the marquee text and shifts it to the end to loop through the text.

Successive calls to the scrollMarquee() function would normally be started by an onload event handler on the body element, but this example has an onclick handler on the marquee itself to start and stop it. The scrollMarquee() function is called recursively via the setTimeout() method. Separate stopMarquee() and switchMarquee() functions use the global TIMEOUT_ID variable to check and control the movement of the marquee.

… full answer hidden

Click for full answers

Premium members click below for full answer
How can I create a scrolling text marquee with DOM scripting?

Premium service benefits

Your premium content subscription is a single payment that gives you:

Home · Web fonts · Font stacks · FAQs · Java · CSS · Javascript · HTML · Site manager