Extras

Resources

Colors

(X)HTML

CSS

Doctypes

Entities

CGI Scripts

Events

Hexadecimals

Tools

Old Way Chapters

Extra Tips

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 pages 314-5 and Appendix C in my book HTML, XHTML, and CSS, 6th Edition: Visual QuickStart Guide, by Elizabeth Castro, published by Peachpit Press.

Event Name and Tags It Works With When It Works

onblur

works with a, area, button, input, label, select, textarea

when the visitor leaves an element that was previously in focus (see onfocus below)

onchange

works with input, select, textarea

when the visitor modifies the value or contents of the element

onclick

works with all elements except applet, base, basefont, br, font, frame, frameset, head, html, iframe, meta, param, script, style, title

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 witha, area, button, input, label, select, textarea

when the visitor selects, clicks, or tabs to the specified element

onkeydown

works with input (of type name or password), textarea

when the visitor types something in the specified element

onkeypress

works with input (of type name or password), textarea

when the visitor types something in the specified element

onkeyup

works with input (of type name or password), textarea

when the visitor lets go of the key after typing in the specified element

onload

works with body, frameset

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 form (not input of type reset)

when the visitor clicks the form’s reset button

onselect

works with input (of type name or password), textarea

when the visitor selects one or more characters or words in the element

onsubmit

works with form (not input of type submit)

when the visitor clicks the form’s submit button

onunload

works with body, frameset

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.