1、内嵌式登记事件(inline)
<script>
function test()
{
alert("单击了我")
}
</script>
<button οnclick="test()">单击我</botton>
2、传统式登记事件
<button id="btn">单击我</botton>
<script>
function test()
{
alert("单击了我");
}
button = document.getElementbyId("btn");
button.onclick = test;
</script>
3、IE事件模型的登记方式
button.attachEvent("onclick",test());//适用与IE浏览器
4、基于DOM Level2模型的登记方式
botton.addEventListener("click",test,false|true)//适用与firefox,opera等浏览器