關於addEventListener()和removeEventListener()
<div id= "div1 "> click me </div>
<script>
var fnClick=function(){
alert( "clicked! ");
};
var oDiv=document.getElementById( "div1 ");
alert( "aa ");
oDiv.addEventListener( "click ",fnClick,false);//出錯.
oDiv.removeEventListener( "click ",fnClick,false);
</script>
當執行addEventListener時候出錯,不支持屬性或方法.
------解决方案--------------------addEventListener, removeEventListener are not supported in Internet Explorer. You can use attachEvent, detachEvent instead.