ie 处理 gif动画 的onload 事件的一个 bug |
如果 <img>标签的 src为一个 gif 动画,那么他的 onload事件会重复触发 。 firefox就没有这样的问题 。 <img src="http://zi.csdn.net/intel_120x60.gif" onload=gorush(this)> <script type="text/javascript"> //by Go_Rush(阿舜) from http://ashun.cnblogs.com/ function gorush(obj){ alert("如果img的src为多帧gif动画,这个会重复弹出") } </script> 解决办法: <img src="http://zi.csdn.net/intel_120x60.gif" onload=gorush(this)> <script type="text/javascript"> //by Go_Rush(阿舜) from http://ashun.cnblogs.com/ function gorush(obj){ alert("这样,就只会弹出一次") obj.onload=null; } </script> 如果 src设置为 静态 gif 或者 jpg ,bmp等其他格式,也不会出现这个bug |