A brief discussion on the attribute list of JavaScript events

Source: Internet
Author: User
Tags list of attributes new features

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.