能不能帮我看一下哪里错了,谢谢
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>事件流</title>
</head>
<body>
<div>
<input type="button" value="按钮" id="btn">
</div>
<script type="text/javascript">
function shoeMes(){
alert('hello world!');
}
var btn=document.getElementById('btn');
/* btn.onclick=function(){
alert('这是通过DOM0级添加的事件!');
} */
var eventUtil={
//添加句柄
addHandler:function(element,type,handler){
if(element.addEventListener){
element.addEventListener(type,handler,false);
}else if(element.attachEvent){
element.attachEvent('on'+type,handler);
}else{
element['on'+click]=handler;
}
},
//删除句柄
removeHandler:function(element,type,handler){
if(element.addEventListener){
element.removeEventListener(type,handler,false);
}else if(element.attachEvent){
element.detachEvent('on'+type,handler);
}else{
element['on'+click]=null;
}
}
}
eventUtil.addHandler(btn,'click',showMes);
</script>
</body>
</html>