Home >>Javascript Tutorial >JavaScript Events

JavaScript Events

JavaScript Events

The JavaScript events are basically the HTML/DOM events and they are used on a wide level and these events are used to execute JavaScript codes. The basic concept of JavaScript Event is that events in HTML are "things" that happen to the elements of HTML and when JavaScript is used in HTML pages, JavaScript can “react” on these events. It is recommended to learn about these events before learning JavaScript. Here are some of the events used in JavaScript:

Events Description
onclick This event occurs when the element is clicked.
ondblclick This event occurs when element is double-clicked.
onfocus This event occurs when an element gets focus such as button, input, textarea etc.
onblur This event occurs when form loses the focus from an element.
onsubmit This event occurs when form is submitted.
onmouseover This event occurs when mouse is moved over an element.
onmouseout This event occurs when mouse is moved out from an element (after moved over).
onmousedown This event occurs when mouse button is pressed over an element.
onmouseup This event occurs when mouse is released from an element (after mouse is pressed).
onload This event occurs when document, object or frameset is loaded.
onunload This event occurs when body or frameset is unloaded.
onscroll This event occurs when document is scrolled.
onreset This event occurs when form is reset.
onkeydown This event occurs when key is being pressed.
onkeypress This event occurs when user presses the key.
onkeyup This event occurs when key is released.