js 阻止冒泡事件和默认事件

阻止事件冒泡   window.enent ? window.enent.cancelBubble = true : e.stopPropagation()

function stopBubble(event){
if(window.event){//兼容IE
window.event.cancelBubble=true;
}else{
event.stopPropagation();
}
阻止默认事件  window.event? window.event.returnValue=false : event.preventDefault(): return false
function stopDefaultEvent(event){ if(window.event){//兼容IE window.event.returnValue=false; }else{ event.preventDefault() } return false; }
原文地址:https://www.cnblogs.com/yxdlm/p/10522199.html