大家帮我看看我这个DOM处理的到底问题出在哪里?
var bt06=document.getElementById("bt6");
var eventUtil={
//添加句柄
addHandler:function(element,type,handler){ //type事件类型例如:onclick
if(element.addEventListener){
element.addEventListener(type,handler,false);//触发handler操作(冒泡阶段)
}else if(element.attachEvent){
element.attachEvent('on'+type,handler);
}else{
element['on'+type]=handler;//element.onclick===element['onclick']
}
}
//删除句柄
removeHandler:function(element,typt,handler){
if(element.removeEventListener){
element.removeEventListener(type,handler,false);
}else if(element.detachEvent){
element.detachEvent('on'+type,handler);
}else{
element['on'+type]=null;
}
}
}
eventUtil.addHandler(bt06,'click',showMes);
eventUtil.removeHandler(bt06,'click',showMes);