<!DOCTYPE html>
<html>
<head>
<title>DOM事件探秘</title>
<meta charset="utf-8">
</head>
<body>
<input type="button" id="btn" onclick="getMessage()" value="btn1">
<input type="button" id="btn2" value="btn2">
<input type="button" id="btn3" value="btn3">
<script type="text/javascript">
function getMessage(){
alert("hello!");
}
var btn2=document.getElementById('btn2');
btn2.onclick=function(){
alert("这是通过DOM0级调用的程序!");
}
btn2.onclick=null;\\取消按钮的作用
var btn3=document.getElementById('btn3');
btn3.addEventListener('click',getMessage,false);
</script>
</body>
</html>