HTML5 - SPLessons
SPLessons 5 Steps, 3 Clicks
5 Steps - 3 Clicks

HTML5 Events

HTML5 Events

shape Description

Present chapter demonstrates about the HTML5 Events which are used to perform any action on JavaScript or VBScript code given in HTML5 application.Following are list of HTML5 Events
  • Window Events
  • Form Events
  • Keyboard Events
  • Mouse Events
  • Media Events

Window Events

shape Description

Window Events are generated for a window object which are applied in <body> tag. Following are the some of the window events.
Attribute Description
onbeforeprint Used to run the document before printing.
onafterprint Used to run the document after printing.
onbeforeunload Used to run the document before unloading.
onerror Used to run the document when error occurs.
onhaschange Used to run the document after has changed.
onload The attribute get activated on a document on a document when the document has finished loading.
onmessage Used to run the document in offline condition.
onoffline Which runs when the document came to online.
onpageshow A page get displayed when a user navigate to a page.
onpagehide The page get displayed when a user navigate away from the page.
onpopstate Used to run when the window history changes.
onredo Used to run the document when redo operation occurs.
onundo Used to run the document when undo operation occurs.
webstorage Used to run when a web storage area get updated
onresize The attribute get activated by resizing the browser window.

Form Events

shape Description

Form Events performs some actions by triggering form elements inside HTML document. Following are some of the form elements. 
Attribute Description
onblur Used to run before printing of the document.
onafterprint Used to run after printing of the document.
onbehoreunload Used to run before unloaded the document.
onerror Used to run if the document get error.
onhaschange Used to run if the document get any shnages.
onload Is get into action if the document got finished loading.
onmessage Used to run when the document goes offline.
onoffline Used to run when the document came back to online.
onpageshow Is get into action when document get displayed..
onpagehide Is get into action when document window get into hidden.
onpostate Is get into action when window document history has been changed.
onredo Is get into action when document performed redo operation.
onundo Is get into action when the document performed undo operation.
on storage Is get into action when web storage is updated.
onresize Is get into action when the browser is resized.

Keyboard Events

shape Description

All keys events are performed using Keyboard Events. Following are the some of the Keyboard events.
Attribute Description
onkeydown Is get into action when pressing a key.
onkeypress Is get into action when press a key.
onkeyup Is get into action when release a key.

Mouse Events

shape Description

All events performed by mouse actions are known as Mouse Events. Following are the some of the mouse actions.
Attribute Description
onclick Is get into action when mouse click on element.
ondbclick Is get into action when mouse double click on the element.
ondrag Is get into action when mouse dragged the element.
ondragenter Is get into action when the element dragged to the valid target.
ondragleave Is get into action when the element leaved at the valid drop target.
ondragend Is get into action when runs at the end of drag operation.
ondragstart Which runs when start the drag action.
ondrop Is get into action when dragged element is dropped
onmousedown Is get into action when the mouse button pressed down
onmousemove Is get into action when the mouse pointer moves over an element.
onmouseout Is get into action when the mouse pointer moves out of an element.
onmouseover Is get into action when the mouse pointer moves over an element.
onmouseup Is get into action when the mouse button is released over an element.
onmousewheel Is get into action when mouse wheel is rotated.
onscroll Is get into action when elements scroll bar is scrolled.

Summary

shape Points

  • Every event perform some operations on document.
  • Windows events will use only in body tags.
  • Form events will perform some actions on forms.