*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 @ 2006-08-10 18:43  健忘猪  阅读(518)  评论(0编辑  收藏  举报