var eventUtil={
//addHandler 添加句柄
addHandler:function(element,type,handler){
if(element.addEventListener){
element.addEventListener(type,handler,false);
}else if(element.attachEvent){//IE
element.attachEvent('on'+type,handler);
}else{
element['on'+type]=handler;
// element['onclick']===element.onclick
}
},
// 删除句柄
removeHandler:function(element,type,handler){
if(element.removeEventListener(){
element.removeEventListener(type,handler,false);
}else if(element.detachEvent){//IE
element.detachEvent('on'+type,handler);
}else{
element['on'+type]=null;
}
}
}
eventUtil.addHandler(btn3,'click',showMessage);