Events are a basic operation in JavaScript to respond to users. They are operations that can be detected by JavaScript. every element of a web page can generate certain events. Using these events can trigger JavaScript Functions.
JavaScript event list (event property-condition of occurrence ):
Onabort-the loading of an image is terminated (only used for )
Onblur-when an element loses focus (move the cursor)
Onchange-the user changes the value of a field (used for <input type = "text">, <select>, <textarea>)
Onclick-click object
Ondblclick-double-click an object
Onerror-file or image loading error (, <object>, <style>)
Onfocus-one element gets the focus
Onkeydown-one-key press on the keyboard
Onkeypress-one-click press or hold on the keyboard
Onkeyup-when the pressed key is released
Onload-when the page or image is loaded
Onmousedown-when a mouse key is pressed
Onmousemove-move the mouse
Onmouseout-the mouse is removed from an element
Onmouseover-move the mouse over an element
Onmouseup-The mouse key is released
Onreset-reset button clicked
Onresize-the window or frame size is changed
Onselect-text selected
Onsubmit-click the submit button
Onunload-the user closes the page
Onload and onUnload
Onload and onUnload events are triggered when the user enters or leaves the page.
The onload event is usually used to check the browser type and version of the visitor and load the appropriate webpage version based on the information.
Onload and onUnload events are often used to set cookies when users enter or leave the page.
OnFocus, onBlur and onChange
OnFocus, onBlur, and onChange events are usually used in conjunction with form field verification.
OnSubmit
The onSubmit event is usually used to verify all domain values before the form is submitted.
OnMouseOver and onMouseOut
OnMouseOver and onMouseOut are usually used to generate animation buttons.