When js is used to specify a style or bind an event to an Html element, it is easy to bind the style or event to the parent element of the target element because the browser event is captured/bubbling, if you only want to bind a style or event to a specified target element, you need to cancel the event bubble action.
Unfortunately, IE uses a different method to stop event bubbling than other browsers. other browsers use W3C-compliant methods. all browsers are used to judge when executing the stop event bubbling function, the function is as follows:
Copy to ClipboardReference: [www.bkjia.com] function stopBubble (e)
{
// If an object is input, the W3C standard method is used only in non-ie browsers.
If (e | e. stopPropagation)
{
E. stopPropagation ();
}
Else
{
// Use IE to stop event bubbling
Window. event. CancelBubble = true;
}
}