Before the incident bubbling problem, also went to the internet to search for some, the results are mostly the same code, posted to the time is not very smooth. When it comes to FF, you can use E.stoppropagation (); , somehow I didn't succeed. However, I find that FF supports e.cancelbubble = True, and is tested and feasible. Just post the code here, and the province can look everywhere. The compatibility of previous versions of IE has not been tested, and then perfected it.
Copy Code code as follows:
Cancel Event Bubbling
function Stopbubble (e) {
var evt = (e)? e:window.event;//compatible FF
Evt.cancelbubble = true; Evt.stoppropagation (); FF block Bubble, said to be able to use
};
Other:
1, cancelbubble (HTML DOM Event object property): If the event handle wants to prevent an event from propagating to an containment object, you must set the property to True.
2, Stoppropagation (HTML DOM Event object method): Termination of events in the propagation process of capture, target processing or foaming phase further spread. When this method is invoked, the handler for the event on the node is invoked and the event is no longer assigned to another node.
3, Preventdefault (HTML DOM Event object method) notifies the browser not to perform the default action associated with the event.
Example:
function Stopbubble (e)
{
if (e && e.stoppropagation)
E.stoppropagation ()
Else
Window.event.cancelbubble=true
}
Put this stopbubble (e) function in the blocking event bubbling function you want to prevent the event from bubbling.