This article is a brief introduction to the JavaScript event attribute list, very detailed, recommended to the same needs of the small partners.
One of the new features of HTML 4.0 is the ability to cause HTML events to trigger behavior in the browser, such as when a user clicks on an HTML element to start a JavaScript. The following is a list of attributes that you can insert into an HTML tag to define the behavior of the event.
Property |
When this event occurs ... |
Onabort |
The image load was interrupted. |
Onblur |
Element loses focus. |
OnChange |
The contents of the domain are changed. |
OnClick |
An event handle that is invoked when a user clicks on an object. |
OnDblClick |
The event handle that is invoked when the user double-clicks an object. |
OnError |
An error occurred while loading the document or image. |
onfocus |
element to gain focus. |
OnKeyDown |
One of the keyboard keys is pressed. |
onkeypress |
One of the keyboard keys is pressed and released. |
OnKeyUp |
A keyboard key was released. |
OnLoad |
A page or an image completes loading. |
OnMouseDown |
The mouse button is pressed. |
OnMouseMove |
The mouse is moved. |
onmouseout |
The mouse moves away from an element. |
onmouseover |
Move the mouse over an element. |
OnMouseUp |
The mouse button is loosened. |
OnReset |
The reset button is clicked. |
OnResize |
The window or frame is resized. |
Onselect |
Text is selected. |
OnSubmit |
The confirmation button is clicked. |
OnUnload |
The user exits the page. |
Mouse/Keyboard Properties
Returns the node associated with the target node of the event.
property |
description |
Altkey span> |
returns whether "ALT" is pressed when the event is triggered. |
button |
returns which mouse button is clicked when the event is triggered. |
ClientX |
returns the horizontal coordinates of the mouse pointer when the event is triggered. |
ClientY |
returns the vertical coordinates of the mouse pointer when the event is triggered. |
ctrlkey |
returns whether the "Ctrl" key is pressed when the event is triggered. |
metakey |
Returns whether the META key is pressed when the event is triggered. |
relatedtarget |
ScreenX |
returns the horizontal coordinates of the mouse pointer when an event is triggered. |
ScreenY |
returns the vertical coordinates of the mouse pointer when an event is triggered. |
shiftkey |
Returns whether the SHIFT key is pressed when the event is triggered. |
Events for common HTML elements:
OnClick (click),
OnDblClick (Double-click),
OnKeyDown (Press the key),
onkeypress (click the button),
OnKeyUp (press release),
OnMouseDown (mouse down),
OnMouseMove (mouse move),
onMouseOut (mouse away from element range),
onMouseOver (mouse move to element range),
OnMouseUp (mouse button release),
OnContextMenu (triggered when the right mouse button is clicked in the browser to display "right-click menu")
The above is the entire content of this article, I hope you can enjoy.