if(ele.addEventListener) //符合w3c标准的浏览器 { ele.addEventListener("click", function (e){ e.stopPropagation(); }); } else{// IE8及以下 ele.attachEvent("onclick",function (e){ e = e || window.event; e.cancleBubble = true; }); }
时间: 2024-10-07 21:13:25
if(ele.addEventListener) //符合w3c标准的浏览器 { ele.addEventListener("click", function (e){ e.stopPropagation(); }); } else{// IE8及以下 ele.attachEvent("onclick",function (e){ e = e || window.event; e.cancleBubble = true; }); }