EventUntil var EventUntil = { addHandler:function(element,type,handler){ if(element.addEventListener){ //先检测DOM2级 element.addEventListener(type,handler,false) }else if(element.attachEvent){ //再检测IE element.attachEvent('on'+typ
var EventUntil = { addHandler:function(element,type,handler){ if(element.addEventListener){ //先检测DOM2级 element.addEventListener(type,handler,false) }else if(element.attachEvent){ //再检测IE element.attachEvent('on'+type,handler) }else{ element['on'+type]=handler; //最后检测DOM0级事件侦听器 } }, removeHandler:function(element,type,handler){ if(element.removeEventListener){ element.removeEventListener(type,handler,false) }else if(element.detachEvent){ element.detachEvent('on'+type,handler) }else{ element['on'+type]=null; } }, getEvent:function(event){ return event?event:window.event }, getTarget:function(event){ return event.target||event.srcElement; }, preventDefault:function(event){ if(event.preventDefault){ event.preventDefault() }else{ event.returnValue = false; } }, stopPropagation:function(event){ if(event.stopPropogation){ event.stopPropogation() }else{ event.cancleBubble=true; } } }