很多时候,我们需要阻止一些事件的默认行为,比如有的时候一些锚链接等等。
- 兼容性相关的可以参考:http://zhangyaochun.iteye.com/blog/1163331
- event的知识参考:http://zhangyaochun.iteye.com/blog/1439502
/*
*preventDefault -- stop the default behavior of event*
*@function*
*@param {Event} e*
*/
ZYC.event.preventDefault = function(e){
if(e.preventDefault){
e.preventDefault();
}else {
// fot ie
e.returnValue = false;
}
};
本文介绍了一个用于阻止事件默认行为的JavaScript函数,并提供了兼容性的解决方案。
1332

被折叠的 条评论
为什么被折叠?



