var EventHandle = { addEvent:function(ele,type,handle){ if (ele.addEventListener) { ele.addEventListener(type,handle,false); }else if(attachEvent){ el ...
var EventHandle = {
addEvent:function(ele,type,handle){
if (ele.addEventListener) {
ele.addEventListener(type,handle,false);
}else if(attachEvent){
ele.attachEvent("on"+type,handle);
}else{
ele["on"+type]=handle;
}
},
deleteEvent:function(ele,type,handle){
if (ele.removeEventListener) {
ele.removeEventListener(type,handle,false);
}else if(detachEvent){
ele.detachEvent("on"+type,handle);
}else{
ele["on"+type]=null;
}
} } //方便使用