var EventUtil = new Object; //增加事件函数 EventUtil.addEventHandler = function(oTarget,sEvetnType,fnHandler){ if(oTarget.addEventListener){ oTarget.addEventListener(sEvetnType,fnHandler,false); }else if(oTarget.attachEvent){ oTarget.attachEvent("on"+sEvetnType,fnHandler); }else { oTarget["on"+sEvetnType] = fnHandler; } } //删除事件函数 EventUtil.removeEventHandler = function(oTarget,sEvetnType,fnHandler) { if(oTarget.addEventListener){ oTarget.removeEventListener(sEvetnType,fnHandler,false); }else if(oTarget.attachEvent){ oTarget.detachEvent("on"+sEvetnType,fnHandler); }else { oTarget["on"+sEvetnType] = null; } }