JS给元素注册事件的办法

<body>
<div id="good" style="height:100px; width:100px;background:#323923"></div>
<script>
document.getElementById("good").attachEvent("onclick", function() {alert("haha");});
</script>
</body>
posted @ 2012-05-15 16:29  Mister Zhai  阅读(289)  评论(0编辑  收藏  举报