js 阻止冒泡法

来源:互联网 发布:暴走大事件之网络语 编辑:程序博客网 时间:2024/06/05 21:33

//js处理时间

//得到事件
   var e = arguments[2] || window.event;
   
   if(e.stopPropagation) { //ff阻止冒泡方法
    e.stopPropagation();
   } else {
    e.cancelBubble = true; //IE阻止冒泡方法
   }

 

jquery阻止冒泡的方法

$(this).children("span").children("strong").children("a").bind("click",function(event){
    event.stopPropagation();    //  阻止事件冒泡
   });

 

调用的页面代码:

infra.module.WorkPlatform.xClick(this,true,event)

原创粉丝点击