Prohibition of incident:
All events will bubbber to their parent elements, and unless the event is prohibited during the bubbling process, the event will be recursively along the path of the Document Object (Document Object). To prohibit an event, you must set the value of the Window.Event.cancelbble property to "True" in the event handle. Note that unless the event is banned, otherwise, in the process of bubbling along the hierarchy, it will be processed by all the parent elements of this event handle, even if it has been processed in child elements. . The default behavior for prohibiting event bubbling and prohibiting events is different. Some events (for example: OnClick on an anchor) have default behavior. When an anchor is clicked, its default behavior is to navigate the current window to the URL specified by its SRC property. Returns "false" in the event handle, or set the Window.Event.ReturnValue property to "false", and the default behavior of the event can be disabled, but the incident is not prohibited from bubbling. It is forbidden to bubbling up, and only the Window.Event.ReturnValue property is set to "True", which corresponds to the pre-emptive settings, and will prohibit the default behavior of the event.
The last example is to demonstrate how to use event bubbling to apply a common effect to a set of elements. If you want to exclude one of the elements in this effect, just simply put the following line of code, from:
HAM span>
change into:
οnmοuseοut = "Window.Event.cancelbubble = true;"> HAM span> Yes. (Example Super Link: http://msdn.microsoft.com/workshop/samples/author/dhtml/overview/Dom_03.htm) Further think: In some cases, you can only register on an object and consider the following situation: Div> If you move your mouse pointer on the IMG object, the event will be excited in the order below: MyDiv :: OnMouseOver Mydiv :: onmouseout MyImg :: OnMouseover Remove your mouse pointer from the IMG object will once again stimulate the MyDiv :: ONMOUSEOVER event. Sometimes, web producers may want to detect when the mouse pointer moves out of a DIV object to achieve a particular effect. At this time, it is not enough to simply set the onmouseout event. In order to make this situation easier, IE4.0 standard adds to the ONMOUSEOVER and the ONMOUSEOUT event to indicate the properties of the source object (TOEELEMENT), you can integrate these properties and containers to identify the mouse pointer? A area is removed. The following example demonstrates how to use these properties and methods: (Example Super Link: http://msdn.microsoft.com/workshop/samples/author/dhtml/overview/Dom_04.htm) οnmοuseοver = "over ();" οnmοuseοut = "OUT ();">> Div> Function over () { Var S; S = "OnMouseover:" WINDOW.EVENT.SRCELEMENT.ID "from:" Window.event.Fromelement.id "to:" window.event.toelement.id; Alert (s); } Function OUT () { Var S; S = "onmouseout:" window.event.srcelement.id "from:" Window.event.Fromelement.id "to:" window.event.toelement.id; Alert (s); IF (! (OuterDiv.Contains (Window.Event.toElement))))) / * OnMouseout event is not excited by the mouse pointer from the OuterDIV object to the IMG object bordered inside, ie: the mouse pointer is the real departure area (translator note) * / { Alert ("Out now"); } } Script> Body> related topic: · Handling Windows, Framers and Dialogs Working with Windows, Frames, And Dialog Boxes · Write scripting with elements and collections for the collection and elements Scripting Scripting with Elements and Collectes · Understanding event mechanism Understanding the Event Model · Script of Cross Frame Write and Data Security About Cross-Frame Scripting and Security