阻止事件传播的常用方法

1、阻止事件的默认行为

function preventDefa(e){ 
  if(window.event){ 
    //IE中阻止函数器默认动作的方式  
    window.event.returnValue = false;  
  } 
  else{ 
    //阻止默认浏览器动作  
    e.preventDefault(); 
  }  

2、阻止事件冒泡

  //阻止冒泡事件的兼容性处理 
    function stopBubble(e) { 
        if(e && e.stopPropagation) { //非IE 
          e.stopPropagation(); 
        } else { //IE 
          window.event.cancelBubble = true; 
        } 
      } 
原文地址:https://www.cnblogs.com/cloud-k/p/7681497.html