找不出错误的原因
<!DOCTYPE html>
<html>
<title>跨浏览器事件兼容</title>
</head>
<body>
<h1>JavaScript</h1>
<p id="con">做为一个Web开发师来说,如果你想提供漂亮的网页、令用户满意的上网体验,JavaScript是必不可少的工具。</p>
<form>
<input type="button" value="0-0" id="a1" />
</form>
</body>
<script type="text/javascript">
function a1(){
alert("0-0-00");}
var a2=document.getElementById("a1");
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"+type]=handler;
}
}
/*removeHandler:function(element,type,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(a2,'click',a1);
</script>
</html>