HTML and CSS Reference
In-Depth Information
EXAMPLE 10.10 ( CONTINUED )
<br />
4
<img src="alarm.jpg" border=2>
<p>
Watch the status bar
<br />
5
<form>
<input type="button"
value="click here"
6
onClick="changeStatusBar();" >
</form>
</font>
</div>
</body>
</html>
EXPLANATION
1
A JavaScript function, called changeStatusBar() , is defined. Its purpose is to print
a message in the status bar of the window for six seconds.
2
A string value is assigned to the status property of the window. The string “ See me
now before I disappear! ” will appear in the status bar at the bottom of the window.
3
The setTimeout() method is a window method. After six seconds, the status bar
will be set to an empty string. Once the setTimeout() completes, it doesn't auto-
matically start up again as setInterval() does.
4
This is an image of a clock that displays on the screen, just for decoration.
5
An HTML form starts here. The user will see a button, with the text “ click here ,”
on the button.
6
When the user presses the button, the onClick event handler is triggered, causing
the function changeStatusBar() to be invoked. See Figure 10.19.
Figure 10.19 Click the button and watch the status bar.
 
Search WWH ::




Custom Search