1. event object: used to obtain event details, such as the mouse position and keyboard buttons. For example, you can obtain the abscissa of the mouse: event object. clientX. ClientX is the visible zone coordinate, and the scroll bar distance is
3. Event delegation : Leveraging event bubbling technology. The event of the child element eventually bubbles to the parent element until it is followed by the node. Event snooping parses events that bubble up from child elements. Benefits of Event
bubbling and default behaviorIf multiple elements overlap in the page, and the overlapping elements are bound to the same event, a bubbling problem occurs.example, the HTML code is as follows:DOCTYPE HTML>HTML>Head> MetaCharSet= "UTF-8"> title>
Ah, the event also has the object yo. Programmers have been talking about object objects, so, is it time to bring an object home for the new year?Well, since the event has an object, admit the fact! Haha, then, it has attributes, next, put aFor
Always get dizzy by the Clientx,offsetx,screenx,pagex of JavaScript's event object, so I decided to make a diagram to distinguish it (drawing my hand that acid ...). )First summarize the following differences:Event.clientx, Event.clientyThe x, Y
Event attributes and methods:
1. type: event type, such as click in onlick;
2. srcElement/target: the event source, which is the element of the event;
3. button: Declares the mouse key to be pressed. An integer. 1 indicates the left button, 2
For the event, everyone is certainly not unfamiliar. jquery events are the same as JavaScript events, except that jquery encapsulates cross-browser events, and everyone works, without having to write a bunch of logic to judge the disgusting
We usually call the HTML DOM event object an eventEvent-driven modelsEvent Source: (the element that triggered the event) the event source object refers to the events objectIt encapsulates detailed information related to the event.Objects that can
Event ObjectThe event object represents the state of the incident, such as the element in which the event occurred, the state of the keyboard key, the position of the mouse, and the state of the mouse button.Events are often used in conjunction with
HTML DOM Event ObjectEvent ObjectThe event object represents the state of the incident, such as the element in which the event occurred, the state of the keyboard key, the position of the mouse, and the state of the mouse button.Events are often
Due to the differences in original event objects in various browsers, most JS libraries/frameworks fix and package native event objects more or less.
For example, use cancelBubble to stop event bubbling IE, and use stopPropagation in standard
JS has a variety of event objects, compatibility is uneven, this object encapsulates most of the required methodsvarEventutil={addhandler:function (element,type,handler) {//Add Event if(Element.addeventlistener) {Element.addeventlistener
whichproperty is used to return the keyboard key or mouse button that is pressed when the current event is triggered .For keyboard and mouse events, this property is used to determine which keyboard key or mouse button you are pressing.whichThe
The event of the final incoming event handler has actually been standardized by JQuery,
Its original event object is stored in the Originalevent property of the event object.
Each event is an instance of Jquery.event, with six methods stored in
Event attributes and methods: 1. type: event type, such as click in onlick; 2. srcElement/target: Event source, which is the element of the event; 3. button: Declares the mouse key to be pressed. An integer. 1 indicates the left button, 2 indicates
The event object of IE browser is different from that of W3C. Therefore, we encapsulate an EventUtil class to make the event object of IE browser the same as that of W3C.
The Code is as follows:
Untitled document
Recently, due to work needs, I have been working on js for many days. When my wife asked me about ajax and asked me about js, she was not interested, I feel good about myself. After all, I have a sense of accomplishment when I make something. Here I
Event Object: An object is generated when a DOM event is triggeredEvents Object Event: 1) Type: Get event Type2) Target: Get event target3) Stoppropagation (): Block event bubbling4) Preventdefault (): Block event default behavior DivID= "Div">
JavaScript event (3) event object1. Recognize that event object events exist in the browser in the form of objects, that is, events. When an event is triggered, an event object is generated, which contains all event-related information. Includes the
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.