var EventUtil = { addHandler:function(elm,type,handler){ //添加事件 if(elm.addEventListener){ elm.addEventListener(type,handler,false); }else if(elm.attachEvent){ elm.attachEvent('on'+type,handler); }else{ elm['on'+'type']= handler; } }, removeHandler:function(elm,type,handler){ //移除事件 if(elm.removeEventListener){ elm.removeEventListener(type,handler,false); }else if(elm.detachEvent){ elm.detachEvent('on'+type,handler); }else{ elm['on'+type]=null; } }, getEvent:function(event){ //获取e 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.stopPropagation){ event.stopPropagation(); }else{ event.cancleBubble= true; } }}