HTML and CSS Reference
In-Depth Information
4 <body onLoad = "startup()">
Get Dizzy. Watch the title bar and the status bar!!
<image src="christmasscene.bmp">
This is the same program as Example 10.11 using the setInterval() method for set-
ting a timer. The function called startup() contains the code to start the scrolling.
The setInterval() method is a window method and is executed and calls scroller() at
intervals of 500 milliseconds (.5 seconds), and will continue to do so until the win-
dow is exited or the clearInterval() method is called. In Example 10.11 we used set-
Timeout() instead of setInterval() .
This is the scroller() f unction that creates the text in both the title bar and the sta-
tus bar. It is executed at .5 second intervals.
When the page has finished loading, the onLoad event handler will call startup() .
Figure 10.21 The string “ Only 19 shopping days left until Christmas! ” scrolls
continuously in the title bar and in the status bar. How annoying!
The scrollTo() Method. This JavaScript method scrolls the content of a window to a
specified x/y coordinate pixel position. This method is only useful where there are areas of
the document not viewable within the current viewable area of the window. If you open
up another window, you might want to scroll to a particular place in the window based on
the user's selection from a menu in the main window, or you might want to use scrolling
Search WWH ::

Custom Search