Home > Article > Web Front-end > Javascript code to unload mouse events_javascript skills
//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>