One of hundreds of answers available with our premium content service.
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
Premium members click below for full answer
How can I create a scrolling text marquee with DOM scripting?
Your premium content subscription is a single payment that gives you: