摘要: Dom0级事件var btn = document.getElementById('btn');btn.onclick = function(event){ alert(this.id);};所有浏览器都支持,作用域为当前绑定元素。IE下没有传入event对象,需要通过window.event获得;其它浏览器均传入event对象Dom2级事件var btn = document.getElementById('btn');btn.addEventListener('click', function(event){ alert(this.id);} 阅读全文
posted @ 2012-05-22 21:26 shinebob 阅读(140) 评论(0) 推荐(0) 编辑