What is Events Attribute in HTML5
In this article I have describe about HTML5 Events.
What is HTML5 Event Attributes
- Trigger events is added HTML4 in our browser, like starting Javascript functionality when the event occurs to click on an element.
- We can respond to an event using an event handler attribute.
- Each HTML element can support a number of distinct event handler attributes.
- Global event attributes that can be added to HTML5 elements.
Window Event Attributes in HTML5
Events triggered for the window object (applies to the <body> tag):
Attribute
|
Status
|
Value
|
Description
|
Onafterprint
|
New
|
Script
|
The document is printed after script to be run
|
Onbeforeprint
|
New
|
Script
|
The document is printed before script to be run
|
Onbeforeonload
|
New
|
Script
|
The document is loads before script to be run
|
Onerror
|
New
|
Script
|
An error occur when Script to be run
|
Onblur
|
No change
|
Script
|
The window loses focus when script to be run
|
Onfocus
|
No change
|
Script
|
The window gets focus when script to be run
|
Onhashchange
|
New
|
Script
|
The document has changed when script to be run
|
Onload
|
No change
|
Script
|
The document loads when script to be run
|
Onmessage
|
New
|
Script
|
The message is triggered when script to be run
|
Onoffline
|
New
|
Script
|
The document goes offline when script to be run
|
Ononline
|
New
|
Script
|
The document comes online when script to be run
|
Onpagehide
|
New
|
Script
|
The window is hidden when script to be run
|
Onpageshow
|
New
|
Script
|
The window becomes visible when script to be run
|
Onpopstate
|
New
|
Script
|
The window's history changes when script to be run
|
Onredo
|
New
|
Script
|
The document performs a redo when script to be run
|
Onresize
|
New
|
Script
|
The window is resized when script to be run
|
Onstorage
|
New
|
Script
|
A Web Storage area is updated when script to be run
|
Onundo
|
New
|
Script
|
The document performs an undo when script to be run
|
onunload
|
New
|
Script
|
The user leaves the document when script to be run
|
From Event
Events triggered by actions inside a HTML form (applies to all HTML5 elements, but is most common in form elements):
Attributes
|
Status
|
Value
|
Description
|
onchange
|
No change
|
Script
|
An element changes when script to be run
|
Onblur
|
No change
|
Script
|
The element loses focus when script to be run
|
Onfocus
|
No change
|
Script
|
The element gets focus when script to be run
|
Oncontextmenu
|
New
|
Script
|
A context menu is triggered when script to be run
|
Onfromchange
|
New
|
script
|
A form changes when script to be run
|
Onfrominput
|
New
|
script
|
A form gets user input when script to be run
|
Oninput
|
New
|
script
|
An element gets user input when script to be run
|
Oninvalid
|
New
|
script
|
An element is invalid when script to be run
|
Onselect
|
New
|
script
|
An element is selected when script to be run
|
onsubmit
|
New
|
script
|
A form is submitted when script to be run
|
You may also want to read these related articles :
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here