Event Attributes
This reference covers event attributes that would be used to capture an event, and trigger an action with a client-side scripting language such as JavaScript.
A note of caution, though. You might intend to apply any of these inline event handlers like so:
<span onmouseover="showhoverhelp">view details</span>
However, this is no longer a recommended technique, as it mixes the document’s structure and content (the HTML) with the behavior (JavaScript). The preferred option is to use unobtrusive JavaScript, which negates the need for inline event handlers of this type, and keeps the document structure and content layers separate from its behavior.
In this Section
onblur
captures the moment that this element loses focusonchange
captures the moment when the value of this element is changedonclick
captures a mouse click on the elementondblclick
captures a double mouse click on this elementonfocus
captures the moment that this element receives focus, either via the cursor or keyboard navigationonkeydown
captures the event in which a key pressed down (but not released) while focus is on the elementonkeypress
captures a key press while focus is on this elementonkeyup
captures the moment at which a pressed key is released while focus is on the elementonload
catches the point at which a page has completely loadedonmousedown
captures the pressing down of the mouse button while the cursor is positioned over the elementonmousemove
captures a mouse movement within this elementonmouseout
captures the movement of a cursor off an area covered by this elementonmouseover
captures the movement of a cursor into an area covered by this elementonmouseup
captures the release of a previously pressed mouse button while the cursor is over the elementonreset
captures the moment that this form’s Reset button is activatedonselect
captures the event in which the user selects, or highlights, text in the elementonsubmit
captures the moment that theformelement to which this attribute is applied is submittedonunload
catches the point at which a page has unloaded
User-contributed notes
There are no comments yet.
Add a note
To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.