码迷,mamicode.com
首页 > 其他好文 > 详细

IE与火狐下兼容(阻止冒泡事件)

时间:2014-11-14 13:52:01      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:io   ar   for   on   cti   amp   window   c   ca   

function stopEvent(){ //阻止冒泡事件
//取消事件冒泡
var e=arguments.callee.caller.arguments[0]||event; //若省略此句,下面的e改为event,IE运行可以,但是其他浏览器就不兼容
if (e && e.stopPropagation) {
// this code is for Mozilla and Opera
e.stopPropagation();
} else if (window.event) {
// this code is for IE
window.event.cancelBubble = true;
}
}

IE与火狐下兼容(阻止冒泡事件)

标签:io   ar   for   on   cti   amp   window   c   ca   

原文地址:http://www.cnblogs.com/bigdesign/p/4096969.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!