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]