Home  >  Article  >  Web Front-end  >  Javascript code to unload mouse events_javascript skills

Javascript code to unload mouse events_javascript skills

WBOY
WBOYOriginal
2016-05-16 19:13:341042browse

//by xmg
<script> <BR>function addEvent(obj,eventName,eventFunc){ <BR> if(obj.attachEvent) { <BR> obj.attachEvent(eventName,eventFunc); <BR> }else if(obj.addEventListener){ <BR> eventName = eventName.toString().replace(/on(.*)/i,'$1'); <BR> obj.addEventListener(eventName,eventFunc,true); <BR> } <BR>} <BR>function delEvent(obj,eventName,eventFunc){ <BR> if(obj.detachEvent) <BR> obj.detachEvent(eventName,eventFunc) <BR> else if(obj.removeEventListener){ <BR> eventName = eventName.toString().replace(/on(.*)/i,'$1'); <BR> obj.removeEventListener(eventName,eventFunc,true); <BR> } <BR>} <BR></script>













<script> <BR>function test1(){ <BR> alert("test1") <BR>} <BR>function test2(){ <BR> alert("test2") <BR>} <BR>document.onclick=function(){ <BR> alert(1) <BR>} <BR></script>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn