Within the tag created in step 1, type event, where event is an intrinsic event as defined below (Figure 19.7). Unless otherwise noted, most events can be used with most (X)HTML tags. Figure 19.7. The event name and the script itself go right inside the (X)HTML tag. Make sure to enclose the script in double quotation marks. onload occurs when a browser loads a page or frameset. onunload occurs when it unloads. They can be used in the body or frameset tags. onclick occurs when the visitor clicks an element. ondblclick occurs when they double click it. onmousedown occurs when the visitor points at an (X)HTML element and presses the mouse button down. onmouseup occurs when they let go. onmouseover occurs when the visitor points at an element. onmousemove occurs when the visitor moves the pointer that is already over an element. onmouseout occurs when the visitor moves the pointer away from the element. onselect occurs when the visitor selects some text in a form element. onfocus occurs when the visitor selects or tabs to an element. onblur occurs when the visitor leaves an element that was "in focus". onkeypress occurs when the visitor types any character in a form element. onkeydown occurs even before the visitor lets go of the key and onkeyup waits until the visitor lets go of the key. As you might imagine, these only work with form elements that you can type in. onsubmit occurs when the visitor clicks the submit button in a form (see page 272). onreset occurs when the visitor resets the form (see page 274). onchange occurs when the visitor has changed the form element's value and has left that element (by tabbing out or selecting another). |