//跨浏览器兼容问题
Util = {
//添加类名
add : function(ele,type,hand){
if(ele.addEventListener){
ele.addEventListener(type,hand,false);
}else if(ele.attachEvent){
ele.attachEvent("on" + type,hand);
}else{
ele["on" + type] = hand;
}
},
//删除类名
remove : function(ele,type,hand){
if(ele.removeEventListener){
ele.removeEventListener(type,hand,false);
}else if(ele.detachEvent){
ele.detachEvent("on" + type,hand);
}else{
ele["on" + type] = null;;
}
},
//兼容事件对象
getEvent : function(event){
return event ? event : window.event;
},
//兼容获取当前标签
getTarget : function(event){
return event.target || event.srcElement;
}
},