One of the new features of HTML 4.0 is to enable HTML events to trigger behavior in the browser, for example, when a user clicks on an HTML element to start a JavaScript. Here is a list of properties that can be inserted into an HTML tag to define event behavior.
If you want to learn how to use these events for programming, then you should learn about our JavaScript tutorials and DHTML tutorials.
Window event (Windows events)
Valid only in the body and frameset elements.
Properties |
value |
Description |
OnLoad |
Script |
Execute script when document is loaded |
OnUnload |
Script |
Execute script when document is removed |
Form elements event (form element events)
Valid only in form elements.
Properties |
value |
Description |
OnChange |
Script |
Execute script when element changes |
OnSubmit |
Script |
Execute script when form is submitted |
OnReset |
Script |
Execute script when form is reset |
Onselect |
Script |
Execute script when element is selected |
Onblur |
Script |
Execute script when element loses focus |
onfocus |
Script |
Execute script when element gets focus |
Keyboard event (Keyboard events)
Not valid in the following elements: base, BDO, BR, Frame, frameset, head, HTML, iframe, Meta, param, script, style, and title element.
Properties |
value |
Description |
OnKeyDown |
Script |
Execute script when keyboard is pressed |
onkeypress |
Script |
Execute script when keyboard is pressed and released |
OnKeyUp |
Script |
Execute script when keyboard is released |
Mouse events (Keyboard events)
Not valid in the following elements: base, BDO, BR, Frame, frameset, head, HTML, iframe, Meta, param, script, style, and title element.
property
value |
description |
onclick |
script |
Execute script when mouse is clicked |
ondblclick |
script |
Execute script when mouse is double-clicked |
onmousedown |
Script |
Execute script when mouse button is pressed |
onmousemove |
script |
execute script When mouse pointer is moved |
onmouseout |
script |
execute script when mouse pointer moves out of an element |
onmouseover |
script |
execute script when mouse pointer hovers over an element |
onmouseup |
script |
execute script when mouse button is released |