Events
An intrinsic event determines when an associated script will run. However, not every intrinsic event works with every (X)HTML element. This table illustrates which events and tags work together. For more information about intrinsic events and scripting, please consult Chapter 18 in my book HTML for the World Wide Web: Visual QuickStart Guide, with XHTML and CSS, Fifth Edition, by Elizabeth Castro, published by Peachpit Press.
| Event Name and Tags It Works With | When It Works |
|---|---|
onblur works with |
when the visitor leaves an element that was previously in focus (see onfocus below) |
|
onchange works with |
when the visitor modifies the value or contents of the element |
|
onclick works with all elements except |
when the visitor clicks on the specified area |
|
ondblclick works with same elements as onclick |
when the visitor double clicks the specified area |
|
onfocus works with |
when the visitor selects, clicks, or tabs to the specified element |
|
onkeydown works with |
when the visitor types something in the specified element |
|
onkeypress works with |
when the visitor types something in the specified element |
|
onkeyup works with |
when the visitor lets go of the key after typing in the specified element |
|
onload works with |
when the page is loaded in the browser |
|
onmousedown works with same elements as onclick |
when the visitor presses the mouse button down over the element |
|
onmousemove works with same elements as onclick |
when the visitor moves the mouse over the specified element after having pointed at it |
|
onmouseout works with same elements as onclick |
when the visitor moves the mouse away from the specified element after having been over it |
|
onmouseover works with same elements as onclick |
when the visitor points the mouse at the element |
|
onmouseup works with same elements as onclick |
when the visitor lets the mouse button go after having clicked on the element |
|
onreset works with |
when the visitor clicks the form’s reset button |
|
onselect works with |
when the visitor selects one or more characters or words in the element |
|
onsubmit works with |
when the visitor clicks the form’s submit button |
|
onunload works with |
the browser loads a different page after the specified page had been loaded |
©Copyright 2002 by Elizabeth Castro. All rights reserved.
Please don't copy this page. Instead, link to it! Thanks.