JavaScript HTML DOM Events

When an HTML event occurs, HTML DOM allows JavaScript to respond accordingly. Some of these HTML events are:

Onclick

Occurrence: when an element is clicked.

Ondblclick

Occurrence: when an element is double-clicked.

Onfocus

Occurrence: when an element gets focus such as button, input, textarea, etc.

Onblur

Occurrence: when form loses the focus from an element.

Onsubmit

Occurrence: when a form is submitted.

Onkeydown

Occurrence: when a key is being pressed.

Onkeypress

Occurrence: when the user presses the key.

Onkeyup

Occurrence: when a key is released.

Onload

Occurrence: when document, object, or frameset is loaded.

Onunload

Occurrence: when the body or frameset is unloaded.

Onscroll

Occurrence: when a document is scrolled.

Onresize

Occurrence: when a document is resized.

Onreset

Occurrence: when a form is reset.

Onmouseover

Occurrence: when the mouse is moved over an element.

Onmouseout

Occurrence: when the mouse is moved out from an element (after being moved over).

Onmousedown

Occurrence: when the mouse button is pressed over an element.

Onmouseup

Occurrence: when the mouse is released from an element (after the mouse is pressed).