HTML BASICS:HTML Event Attributes

HTML Event Attributes

Events are a feature of HTML documents that allow authors to add interactivity between the website and it's visitors, by executing client-side programs when the visitor performs an action. Html can process events from mouse,keyboard etc due to this reason there are different kind of events are present such as mouse event,key board event,form event etc.Content of an event is the code itself. Inorder to create interactive web pages we need different events.

Following tables shows some of the events.

Window events

Attribute Description
onafterprint Script to be run after the document is printed
onbeforeprint Script to be run before the document is printed
onhashchange Script to be run when there has been changes to the anchor part of the a URL
onload Fires after the page is finished loading

Form events

Attribute Description
onblur Fires the moment that the element loses focus
onchange Fires the moment when the value of the element is changed
oncontextmenu Script to be run when a context menu is triggered
onfocus Fires the moment when the element gets focus
oninput Script to be run when an element gets user input

Mouse events

Attribute Description
onblur Fires the moment that the element loses focus
onchange Fires the moment when the value of the element is changed
oncontextmenu Script to be run when a context menu is triggered
onfocus Fires the moment when the element gets focus
oninput Script to be run when an element gets user input




Jesna N Scaria

Articles : 32

I am a Software Developer at Leedhar Technologies
India India