HTML Event Attributes



When a webbrowser reacts on a user reaction,then it's called as an event.

In html there are somany event Attributes available.

Window Event Attributes

Window Eventsare events that are related to window object , it can only be applied with <body > tag.

Attribute Description
onafterprint It return the script after the document is printed.
onbeforeprint It return the script before the document is printed.
onbeforeunload It return the script before a document being unloaded.
onerror It return the script when an error occurs.
onhashchange It return the script when the anchor part in URL of the webpage is changed.
onload It return the script when the webpage is entirely loaded.
onmessage It return the script when a message event occurs.
onunload It return the script when the current webpage is unloaded is closed.
onstorage It return the script when web storage is updated.
onresize It return the script when the window is resized.
onpopstate It return the script when the window's active history is changed.
onpageshow It return the script when the current webDocument is focused.
onpagehide It return the script when the current webpage is hidden.
ononline It return the script when the web browser working online.
onoffline It return the script when the network connection is disconnected



Keyboard Event Attributes

Attribute Description
onkeydown It returns when the user presses a key.
onkeypress It returns when the user presse an key.
onkeyup It returns when the user releases a key.



Mouse Event Attributes

Attribute Description
onclick It returns when the user clicks the left mouse button on the element.
ondblclick It returns when the user double-clicks on the element.
oncontextmenu It returns when a context menu is triggered by the user through right-click on the element.
ondrag It returns when the user drags an element.
ondragend It returns when the user releases the mouse button at the end of a drag operation.
ondragenter It returns when the user drags an element to a valid drop target.
ondragleave It returns when an element leaves a valid drop target during a drag operation.
ondragover It returns when an HTML element is being dragged over a valid drop target.
ondragstart It returns when the user starts to drag a text selection.
ondrop It returns hen dragged element is being dropped.



Form Event Attributes

Attribute Description
onsubmit It fetched when a form is submitted.
onsearch It fetched when the user writes something in a search input field.
onselect It fetched when some text is being selected.
onreset It fetched when the user resets a form.
oninvalid It fetched when a submittable element do not satisfy during form validation.
oninput It fetched when the value of an element is changed by the user.
onfocus It fetched when the element receives focus.
onchange It fetched when the value or state of the element is changed.
onblur It when an element loses focus.

Share On




HTML

Welcome HTML Getting Started HTML Elements HTML Attributes HTML Headings HTML Paragraphs HTML Links HTML Styles HTML Text Formatting HTML Tables HTML Images HTML Forms HTML Lists HTML Iframes HTML Comments HTML CSS HTML Colors HTML Classes HTML Id HTML javascript HTML Filepaths

HTML Advanced

HTML Doctypes HTML Validation HTML Validation HTML URL HTML URL Encode HTML URL Entities HTML Layout HTML Head HTML Meta HTML Scripts HTML Global Attributes HTML Event Attributes HTML Tags

HTML Media

HTML Media HTML Audio HTML Video HTML Plug-ins HTML Youtube

HTML Graphics

HTML Canvas HTML SVG