Since Marquee HTML tag gives us scrolling text in web pages we can use them for various purposes in our page design. One of the common use is scrolling news items in the web page which continuously display scrolling messages. We will learn how to stop this scrolling by placing Mouse pointer over this and again starts scrolling once the mouse is taken out of the scrolling area.
Note that each item can be a different link to different pages or news links so let us try displaying each news item with hyper links to different pages. WE have kept links to different sections of the plus2net here.
The same events can be triggered by onmouseup and onmousedown events
Starting and stopping scrolling text by using Start and Stop button
We will try to control the start and stop of the scrolling of marquee tag through one pair of buttons. We will connect start of scrolling to one button and stopping of scrolling to another button. Here is the code to do that.
We will use getElementById to read the value and the Label on the button.
By using one if condition we will see if the button label ( value ) is Start then we will make it Stop and start the scrolling. Similarly if the label is Stop then we will make it Start and stop the scrolling.
Here is the code
<marquee id='scroll_news4' style="font-family:Book Antiqua; color: #FFFFFF" bgcolor="#000080" >News 1 News 2 News 3 News 4 ....... More news here </marquee>
<input type='Button' value='Stop' id ='b1' onClick='button_click()';>
// End -->
This article is written by plus2net.com team.
Click for more tutorial on marquee tag for scrolling text