You can set up your document to run a script when various events occur, such as mouse clicks or keys struck on the keyboard. To do this, attach one of these intrinsic event attributes to an element; the value of the attribute is an expression in your scripting language that can handle that event.
To use these attributes, you must declare the scripting
language in a
meta element inside the page's
head element. Here is the general form of this
<meta http=equiv='Content-Script-Type' content='
MIME type of the scripting language. For example, the MIME
Here are the intrinsic event attributes, and the things that can happen to an element with that attribute that will cause the script to be run.
When an element loses focus. See the |
When a control on a form changes its value. To be
precise, this happens only when the user moves
focus onto the control, changes the value of an
|When the user clicks the mouse button over the element.|
|When the user double-clicks the mouse on the element.|
At any given time, some element is said to have
focus; this means that any keyboard input from the
user is sent to that element. The |
When a user presses a key; applies to the element
with focus. See |
When a user presses and then releases a key on the
keyboard; applies to the element that has focus.
When a user releases a key after pressing it.
When a |
|When the mouse button is depressed over the element.|
When the mouse is moved within an element. Not
every position will be reported; the faster the
mouse is moved, the fewer |
|When the mouse is moved out of an element.|
|When the mouse is moved onto the element.|
|When the mouse button is released over the element.|
When a user clicks on the reset button of a form;
see Section 14, “Forms: The |
When a user selects some text, as in a |
When a user submits a form; see Section 14, “Forms: The |
When a |