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 element is clicked.

Ondblclick

Occurrence: when 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 form is submitted.

Onkeydown

Occurrence: when key is being pressed.

Onkeypress

Occurrence: when user presses the key.

Onkeyup

Occurrence: when key is released.

Onload

Occurrence: when document, object or frameset is loaded.

Onunload

Occurrence: when body or frameset is unloaded.

Onscroll

Occurrence: when document is scrolled.

Onresize

Occurrence: when document is resized.

Onreset

Occurrence: when form is reset.

Onmouseover

Occurrence: when mouse is moved over an element.

Onmouseout

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

Onmousedown

Occurrence: when mouse button is pressed over an element.

Onmouseup

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

Please Share