这是IE6专有的 bug,令我相当郁闷。此 bug 一般发生在用 innerHTML 方法输出的 html 中。比如我用脚本输出的html中包含 500个 li 列表,每个 li 都在css里定义了背景图(一个小箭头,太常见了
),把这段 html 输出到页面,IE6 居然要载入 500 次背景图片,页面反应速度明显下降。google 之,发现加上一行: document.execCommand("BackgroundImageCache", false, true); 即可解决问题.用下方法来解决(让IE6缓存背景图片):
<!--[if IE 6]>
<script>
document.execCommand("BackgroundImageCache", false, true);
</script>
<![endif]-->
或也可以try一下是很有必要的。
try {
document.execCommand('BackgroundImageCache', false, true);
}
catch(e) {}
将上面这段代码存为一个.js文件,直接引用即可。
联系客服