HTML and CSS Reference
In-Depth Information
been called here such as: < a href=“#” onClick=“validateForm(this)” > and the sub-
mit() method used within the function if the form is OK. (See the section “Form Valida-
tion with Regular Expressions” on page 765 in Chapter 17.)
A deactivated link is assigned an onClick event handler. When the user clicks the
link, the JavaScript code is executed. The pseudo JavaScript: protocol is followed
by a reference to the form and a reset() method, which clears the form fields. See
Figure 13.4.
Figure 13.4 The focus is in the first box and the field is selected (highlighted).
13.3 Handling a Window or Frame Event
A window is the main Web page, unless it is divided up into frames. There are a number
of events that will affect windows and frames; these are described in Table 13.3. The fol-
lowing examples illustrate some of the events that affect windows and frames.
Table 13.3 Window and Frame Events
Event Handler
When It Is Triggered
When the mouse moves away from the window or frame and it loses focus.
When the mouse is clicked or moved in a window or frame and it gets focus.
When a document or image has finished loading.
When a window is moved.
When a page is exited or reset.
13.3.1 The onLoad and onUnLoad Events
The onLoad event handler is invoked on the occurrence of a Load event; that is, when a
document, its frameset, or images have completely finished loading. This includes the
point at which all functions have been defined and scripts have been executed, and all
Search WWH ::

Custom Search