Put your text ad here
WestNIC provides reliable web hosting services
This FAQ answers one of over 700 Web development questions submitted by Code Style readers. Sign-up to our premium content service to view the full answer.
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.
… premium content omitted
Access all premium content for $50: sign-up below.
How can I create a scrolling text marquee with DOM scripting?
Come inside, access hundreds of premium content answers. One payment grants life membership to hundreds of developer FAQs.
The PayPal service allows you to pay securely and independently in your own currency. Payments are billed to Metacentric Internet Limited. We never handle your credit card details.
Direct access to hundreds of answers to common Web development questions with full working examples and links to other Web resources. Your subscription provides full answers to all premium content questions including those listed below, plus:
onclick event on my button is not working! (stub article)
iframe browser and filter the URLs? (stub article)