addEvent 和 delEvent

addEvent 和 delEvent
var test= { $ : function(id){ return document.getElementById(id); }, addEvent : function(obj,eventType,func){ if(obj.attachEvent){obj.attachEvent("on" + eventType,func);}else{obj.addEventListener(eventType,func,false)}}, delEvent : function(obj,eventType,func){ if(obj.detachEvent){obj.detachEvent("on" + eventType,func)}else{obj.removeEventListener(eventType,func,false)} } };

你可能感兴趣的:(addEvent 和 delEvent)