JavaScript [events] [Event Monitoring]

Source: Internet
Author: User

Event

1 /**2 * Event:3 * OnLoad and onunload events are triggered when the user enters or leaves the page4  *5 * onchange events are often combined with validation of input fields6 * The onmouseover and onmouseout events can be used to trigger a function when a user moves the mouse over an HTML element or moves out of an element. 7  *8 * onmousedown, onmouseup, and onclick make up all parts of the mouse click event. First, when you click the mouse button,9 * The onmousedown event is triggered and when the mouse button is released, the OnMouseUp event is triggered and, finally, the onclick event is triggered when the mouse click is completed. Ten  **/ One  Adocument.getElementsByTagName (' body ') [0].onload =function () { -Alert (' Document OnLoad '); -};

Event Monitoring

1 /**2 * EventListener3  *4 * AddEventListener () method5 * Features:6 * 1. The AddEventListener () method is used to add an event handle to the specified element. 7 2. The event handle added by the AddEventListener () method does not overwrite an existing event handle. 8 3. You can add multiple event handles to an element. 9 4. You can add multiple event handles of the same type to the same element, such as: Two "click" Events. Ten 5. You can add event listeners to any DOM object, not just HTML elements. Such as: Window object.  One 6. The AddEventListener () method makes it easier to control events (bubbling and capturing).  A 7. When you use the AddEventListener () method, JavaScript is detached from the HTML markup and is more readable, without the control of HTML markup -  - You can add event listeners.  the 8. You can use the RemoveEventListener () method to remove the listener from the event. (Element.removeeventlistener ("MouseMove", -  - myFunction);) -     * + * Element.addeventlistener (event, function, usecapture); - * Event: Incident Type Click, MouseDown, etc. + * Function: Functions called after the event is triggered A * Usecapture:false (default value, bubbling pass), true (Capture pass) at  * - * Delivery of events: - * 1. Event bubbling: An event of an inner element is first triggered before an external element is triggered -  * - * 2. Event capture: An event of an external element is first triggered before an internal element's event is triggered -  * in * Browser support: - * 01.png to  * +  * */

JavaScript [events] [Event Monitoring]

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.