为了账号安全,请及时绑定邮箱和手机立即绑定

e.stopPropagation() 火狐 失效

e.stopPropagation() 火狐 失效

轩儿news 2016-11-14 15:29:50
本人现在用的代码是:if (event.stopPropagation) {     event.stopPropagation(); }else if (window.event) {     window.event.cancelBubble = true; }
查看完整描述

1 回答

?
轩儿news

TA贡献3条经验 获得超2个赞

找到方法了!累死姥姥了~~~兼容所有浏览器(消除冒泡事件)

function stopEvent(){

var e=arguments.callee.caller.arguments[0]||event;

       if ( e && e.stopPropagation ) {

       e.stopPropagation();

       } else{

             window.event.cancelBubble = true;

       }    

}

查看完整回答
反对 回复 2016-11-17
  • qq_http404_1
    qq_http404_1
    你确定你这段代码是可以运行的?? let e=arguments.callee.caller.arguments[0]||event; 这一行就已经报错了
  • 1 回答
  • 0 关注
  • 2587 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信