zhngutils.js

/**
* @事件只作用在目标对象-不向父级元素传递
* @param me 事件对象
*/
function stopBubble(me){
if(window.event){
me.cancelBubble = true;//事件句柄停止将事件传播到包容对象
}else{//w3c if(e && e.preventDefaut && e.stopPropagation)
//me.preventDefault();//阻止默认行为
me.stopPropagation();//停止传播
}
return false;//对live方式绑定的事件 阻止冒泡
};
/**
* 阻止事件默认行为
* @param e 事件对象
*/
function stopDefault(e){
if(window.event){//ie
window.event.returnValue = false;
}else if(e && e.preventDefault){
e.preventDefault();
}
return false;
};
原文地址:https://www.cnblogs.com/zhng/p/2225051.html