HTML and CSS Reference
In-Depth Information
EXPLANATION ( CONTINUED )
5
The alert dialog box pops up when the page finishes loading.
6
This is a user-defined function that keeps track of the number of seconds that
have elapsed since the page was loaded.
7
The variable called sec is increased by one each time trackTime() is called.
8
This function is called when the page is exited or reloaded. It is the event that is
triggered by the onUnLoad handler on line 10.
9
When the document has finished loading, the onLoad event handler is triggered.
The onLoad event handler is an attribute of the <body> tag. The event handler is
assigned a function called now() that sets up a timer that will go off every second
while the page is opened. After a second passes another function called track-
Time() will keep updating a variable that stores the number of seconds that have
elapsed. The background attribute of the HTML <body> tag is set to an image of
blue hills.
10
The onUnLoad event handler is triggered when the user either leaves or reloads
the page. See Figure 13.5.
Figure 13.5 If you exit or click the reload button, this alert box appears.
 
Search WWH ::




Custom Search