HTML Event Attributes
- Windows Event Attributes:
Attribute Definition onafterprint Script to be run after the document is printed. onbeforeprint Script to be run before the document is printed. onbeforeunload Script to be run before the document is unloaded. onerror Invoked when an error occurs while the element is being loaded. Also handler for script error notifications. onhaschange The hashchange event is fired when navigating to a session history entry whose URL differs from that of the previous one only in the fragment identifier. onload The element has loaded. onmessage Script to be run when the message is triggered. onoffline Script to be run when the document goes offline. ononline Script to be run when the document comes online. onpagehide The pagehide event is fired when traversing from a session history entry. onpageshow The pageshow event is fired when traversing to a session history entry. onpopstate The popstate event is fired when navigating to a session history entry that represents a state object. onredo Invoked when the document performs a redo. onresize Fires when the browser window is resized. onstorage Invoked when a Web Storage area is updated. onundo Invoked when the document performs an undo. onunload Unload event handler.
- Form Events:
Attribute Definition onblur User has left the focus of the element. onchange User has changed the object, then attempts to leave that field (i.e. clicks elsewhere). oncontextmenu Invoked when a context menu has been triggered. onfocus Invoked when the focus is on the element. onformchange Invoked when a form changes. onforminput Invoked when a form gets user input. oninput Script to be run when an element gets user input. oninvalid Script to be run when an element is invalid. onselect Invoked when some or all of the contents of an object is selected. For example, the user selected some text within a text field. onsubmit User submitted a form.
- Keyboard Events:
Attribute Definition onkeydown Invoked when a key was pressed over an element. onkeypress Invoked when a key was pressed over an element then released. onkeyup Invoked when a key was released over an element.
- Mouse Events:
Attribute Definition onclick Invoked when the user clicked on the object. ondblclick Invoked when the user clicked twice on the object. ondrag Invoked when an element is being dragged. ondragend Invoked when an element has stopped being dragged. ondragenter Invoked when an element has been dragged to a drop target. ondragleave Invoked when an element leaves a valid drop target. ondragover Invoked when an element is being dragged over a valid drop target. ondragstart Invoked when a drag operation has started. ondrop Invoked when an element is being dropped. onmousedown The cursor moved over the object and mouse/pointing device was pressed down. onmousemove The cursor moved while hovering over an object. onmouseout The cursor moved off the object. onmouseover The cursor moved over the object (i.e. user hovers the mouse over the object). onmouseup The mouse/pointing device was released after being pressed down. onmousewheel Invoked when the mouse wheel is being rotated. onscroll scroll event handler. Invoked when the element's scrollbar is being scrolled.
- Media Events:
Attribute Definition onabort Invoked when an event has been aborted. For example, the browser stops fetching media data before it is completely downloaded. oncanplay Invoked when the browser/user agent can start playing media, but hasn't yet, due to buffering. In other words, if playback were to begin now, it wouldn't play right to the end (due to the current playback rate) - it would need to pause during playback in order to load the rest of the media. oncanplaythrough The browser/user agent estimates that if playback were to begin now, the media resource could be rendered at the current playback rate all the way to its end without having to stop for further buffering. ondurationchange Invoked when the length of the media is changed (i.e. the duration attribute has just been updated). onemptied Invoked when a media resource element suddenly becomes empty (for example, due to a network error). onended Invoked when the media has reached the end. onerror Invoked when an error occurs when the file is being loaded. onloadeddata Invoked when the browser/user agent can render the media data at the current playback position for the first time. onloadedmetadata Invoked when the browser/user agent has just determined the duration and dimensions of the media resource. onloadstart Invoked when the browser/user agent has started loading the media resource. onpause Invoked when the media resource has been paused. onplay Invoked when the media resource starts playback. onplaying Playback has begun. onprogress The browser/user agent is fetching media data the. onratechange Invoked when the playback rate has changed (i.e. either the defaultPlaybackRate or the playbackRate has just been updated). onreadystatechange Invoked each time the ready state changes (the ready state tracks the state of the media data). onseeked Invoked when the seeking IDL attribute changed to false (i.e. the seeking attribute is no longer true)v onseeking Invoked when the seeking IDL attribute changed to true and the seek operation is taking long enough that the user agent has time to fire the event. onstalled Invoked when the browser/user agent is trying to fetch media data but the data has stalled (i.e. the data has stopped coming). onsuspend The browser/user agent is (intentionally) not currently fetching media data, but has not yet downloaded the entire media resource (i.e. it has suspended the download). ontimeupdate Invoked when the media's current playback position changed. onvolumechange Invoked when either the volume attribute or the muted attribute has changed. onwaiting The next frame of the media is not yet available (but the browser/user agent expects it to become available).
View All HTML Tags