Javascript events


JavaScript can detect the behavior of the page, it called JavaScript events. Here are some examples of common JavaScript events:

  1. The page content is loaded by the browser
  2. The user clicks a button
  3. The user presses a button
Events usually use together with function to accomplish certain action (event-driven functions).

List of commonly used JavaScript events

The following is a list of commonly used JavaScript events :

General Events

Event Properties the condition that triggered the event
onclick Mouse click on an object
ondblclick Double-click an object
onmousedown Press the mouse button
Event Release the mouse button after pressing
onmouseover Move the mouse over an object's range
onmouseout Mouse off a range of objects
onkeydown A key on the keyboard is pressed
events A key on the keyboard is pressed or held down
onkeyup A key on the keyboard (when pressed) is released

Form-Related Events

Event Properties the condition that triggered the event
Event element loses focus
onfocus element gets the focus
onchange The user changes the contents of the form field
onsubmit The form submit button is clicked
onreset The form reset button is clicked

Page related Events

Event Properties the condition that triggered the event
onload The page or image (loaded by the browser) finishes
onunload The user exits the page (or the page changes to another page)
onerror An error occurred while loading a document or image
onresize The window or frame is resized
onmove event The window or frame is moved
onscroll The browser's scroll bar position has changed
onstop Browser's stop button is being pressed or the file being downloaded is interrupted

Edit Event

Event Properties the condition that triggered the event
onselect When the text content is selected
onbeforecopy When the page is selected to be copied to the system clipboard before
oncopy The currently selected content is copied
oncut The currently selected content is clipped
onpaste When the content is pasted



Copyright 2014-2017 by DeveloperTut.com. All Rights Reserved.
TwitterGoogle+Facebook