JavaScript Common Events

Source: Internet
Author: User

JavaScript Common Events

The most common events are:
(1) Click event: OnClick. The event that occurs when the user clicks the mouse button while. Nclick The specified event handler or code will be called for execution.
(2) Change event: OnChange. The event occurs when the character value in the text or TEXTAREA element changes or the Select table option state changes.
(3) Check event: Onselect. This event is raised when text in a text or TextArea object is selected. Such as:
<ipnut type= "text" value= "Default Info" Onselect=alert ("you select text in t text box") >
(4) Get focus event: onfocus. The user clicks the text or textarea and the Select object, which causes the event when the cursor falls in the text box or selection box. Such as:
<select name= "Zhengjian" Onfocus=alert ("I become the Focus") >
(5) Loss of focus event: onblur. The loss of focus event is just the opposite of getting the focus event, which is raised when text or textarea and the Select object no longer has focus and exits the background.
(6) Manned file event: OnLoad, ' generates this event when the paging file is manned. One of the functions of onload is to detect the value of a cookie when a paging file is first manned, use a variable for it to be used by the source code, this event is a window event, but when specifying an event handler in HTML, it is generally written in <body> Tag. Such as:
<body onload=alert ("Loading page, please wait for one") >
(7) Unload file event: OnUnload. With a manned file event. Nload exactly the opposite, the event that is raised when the Web page exits and can be updated. The state of the Ookie. Such as:
<body onunload=confirm ("Are you sure you want to leave this page?") >
(8) Mouse Town cover event: onmouseover, onMouseOver is the event that is raised when the mouse is over the element. Such as:
<input type= "Boutton" value= "button" onmouseover= "window. Status= ' Please note the following status bar ·; return true ">
(9) Mouse leave event: onmouseout, onMouseOut is the event that is raised when the mouse leaves the element. You can create a dynamic button effect if you use it in conjunction with a mouse override event.
(10) General events.
Ondbclick: Mouse Double-click event.
onkeypress: An event that is triggered when a key on the keyboard is pressed and released, requiring that the active object be in the page.
OnKeyDown: An event that is triggered when a key on the keyboard is pressed, requiring that the active object be in the page.
OnKeyUp: An event that fires when a key on the keyboard is released, requiring that an active object be in the page.
(11) Page related events.
Onabort: An event that is triggered when a picture is interrupted by a user while downloading.
onBeforeUnload: The event that is triggered when the content of the current page is about to be changed.

JavaScript-commonly used events

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.