NEW

6/recent/ticker-posts

Header Ads Widget

HTML Event Attributes

 

HTML Event Attributes

When a browser reacts on user action, then it is called as an event. For example, when you click on the submit button, then if the browser displays an information box.

In HTML5 there are lots of event attributes available which can be activated using a programming language such as JavaScript.

Following is a table of event attributes, using these attributes you can perform several events.

Windows Event Attributes

Windows events are related for the window object, and it can only be applied with <body> tag.

AttributeDescription
onafterprintExecuted the script after the document is printed.
onbeforeprintExecuted the script before the document is printed.
onbeforeunloadExecuted the script before a document being unloaded.
onerrorExecuted the script when an error occurs.
onhashchangeExecuted the script when the anchor part in URL of the webpage is changed.
onloadExecuted the script when the webpage is entirely loaded.
onmessageExecuted the script when a message event occurs.
onofflineExecuted the script when the network connection is disconnected, and browser started working offline.
ononlineExecuted the script when the browser started working online
onpagehideExecuted the script when the current webpage is hidden such as if the user has moved away from the current webpage.
onpageshowExecuted the script when the current webpage is focused.
onpopstateExecuted the script when the window's active history is changed.
onresizeExecuted the script when the window is resized.
onstorageExecuted the script when web storage is updated.
onunloadExecuted the script when the current webpage is unloaded, or window is closed.

Form Event Attributes

Form event occurs when the user performs some action within the form such as submitting the form, selecting input field, etc.

The form events can be used with any element, but these are mainly used with HTML form elements.

Following is the list of all Form Event attributes:

AttributeDescription
onblurExecuted the script when form element loses the focus.
onchangeExecuted the script when the value of the element is changed.
onfocusTrigger an event when the element gets focused.
oninputExecuted the script when the user enters input to the element.
oninvalidExecuted the script when the element does not satisfy its predefined constraints.
onresetTriggers the event when user reset the form element values.
onsearchTriggers the event when a search field receives some input.
onselectTriggers the event when the user has selected some text.
onsubmitTriggers the event when a form is submitted.

Keyboard Event Attributes

Keyboard event occurs when a user interacts with the keyboard. Following is a list of the Keyboard event.

AttributeDescription
onkeydownTriggers the event when the user presses down a key on the keyboard.
onkeypressTrigger the event when the user presses the key which displays some character.
onkeyupTrigger the event when the user releases the currently pressed key.

Mouse Event Attributes

AttributeDescription
onclickTrigger the event when the mouse clicks on the element.
ondblclickTrigger the event when mouse double-click occurs on the element.
onmousedownTrigger the event when the mouse button is pressed on the element.
onmousemoveTrigger the event when the mouse pointer moves over the element.
onmouseoutTrigger the event when the mouse moves outside the element.
onmouseoverTrigger the event when the mouse moves onto the element.
onmouseupTrigger the event when the mouse button is released.
onmousewheelDeprecated. Use the onwheel attribute.
onwheelTrigger the event when the mouse wheel rolls up or down on the element

Clipboard Event Attributes

AttributeDescription
oncopyTrigger the event when the user copies the content to the system clipboard.
oncutTrigger the event when the content of an element is cut and copy to the clipboard.
onpasteTrigger the event when the user pastes some content in an element.

Media Event Attributes

AttributeDescription
onabortExecuted the script when media playback is aborted.
oncanplayExecuted the script when the media file is ready to play.
oncanplaythroughExecuted the script when the media file is ready to play without buffering or stopping.
oncuechangeExecuted the script text cue of <track> element is changed.
ondurationchangeExecuted the script when the media file duration is changed.
onemptiedExecuted the script if media occurs some fatal error, and the file becomes unavailable.
onendedExecuted the script when the media file occurs its end point.
onerrorExecuted the script when some error occurred while fetching the media data.
onloadeddataExecuted the script when media data is loaded.
onloadedmetadataExecuted the script when metadata of media file is loaded.
onloadstartExecuted the script when loading of media file starts.
onpauseExecuted the script when media playback is paused.
onplayExecuted the script when media file ready to play after being paused.
onplayingExecuted the script when media file is started playing.
onprogressExecuted the script when the browser is in the process of getting the media data.
onratechangeExecuted the script when playback speed changed.
onseekedExecuted the script when seek operation is ended and seeking attribute is set to false.
onseekingExecuted the script when seek operation is active and seeking attribute is set to true.
onstalledExecuted the script when browser unexpectedly stopped fetching the data media.
onsuspendExecuted the script if fetching of media data is intentionally stopped.
ontimeupdateExecuted the script when playback position is changed, such as if a user fasts forward the track.
onvolumechangeExecuted the script when media volume is changed (muted or unmuted).
onwaitingExecuted the script if playback pause to wait for loading more data.

Post a Comment

0 Comments

Recents Post

Exploring Paidwork - Your Gateway to Earning Online