cloud-k

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; 
        } 
      } 

分类:

技术点:

相关文章:

  • 2021-11-27
  • 2021-12-31
  • 2021-09-04
  • 2021-12-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-27
  • 2021-11-27
  • 2021-11-27
  • 2021-12-23
  • 2021-12-07
  • 2021-11-27
相关资源
相似解决方案