在使用gif动画的时候,也只有仅仅gif动画的时候,img的onload事件会在IE下重复的触发。我用IE tester测试的时候,发如今ie6下就会拼命的触发。测试
例如在<img src="xxx.gif" onload="reload(this)">动画
<script>this
function reload(obj){事件
alert('1');ip
}io
</script>function
你会发现 这样 在IE6下拼命的弹出alert,针对这个bug,咱们能够这样解决:test
function reload(obj){
alert('1');
obj.onload=null; //此处是关键
}bug