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 on associating a script with an intrinsic event, consult Triggering a Script on page 314.
Intrinsic Events
Event | Works With | When |
---|
onblur | a, area, button, input, label, select, textarea | the visitor leaves an element that was previously in focus (see onfocus below) |
onchange | input, select, textarea | the visitor modifies the value or contents of the element |
onclick | All elements except applet, base, basefont, br, font, frame, frameset, head, html, iframe, meta, param, script, style, title | the visitor clicks on the specified area |
ondblclick | Same as for onclick | the visitor double clicks the specified area |
onfocus | a, area, button, input, label, select, textarea | the visitor selects, clicks, or tabs to the specified element |
onkeydown | input (of type name or password), textarea | the visitor types something in the specified element |
onkeypress | input (of type name or password), textarea | the visitor types something in the specified element |
onkeyup | input (of type name or password), textarea | the visitor lets go of the key after typing in the specified element |
onload | body, frameset | the page is loaded in the browser |
onmousedown | Same as for onclick | the visitor presses the mouse button down over the element |
onmousemove | Same as for onclick | the visitor moves the mouse over the specified element after having pointed at it |
onmouseout | Same as for onclick | the visitor moves the mouse away from the specified element after having been over it |
onmouseover | Same as for onclick | the visitor points the mouse at the element |
onmouseup | Same as for onclick | the visitor lets the mouse button go after having clicked on the element |
onreset | form (not input of type reset) | the visitor clicks the form's reset button |
onselect | input (of type name or password), textarea | the visitor selects one or more characters or words in the element |
onsubmit | form (not input of type submit) | the visitor clicks the form's submit button |
onunload | body, frameset | the browser loads a different page after the specified page had been loaded |