日期:2014-05-17  浏览次数:20671 次

老问题,IE6 背景图片缓存。
IE6 下背景图片缓存的BUG会导致hover的时候闪烁

网上找到的解决方案是document.execCommand("BackgroundImageCache", false, true);

之前一直是用IETester 测IE6 没发现问题, 可是今天发现 在Xp sp2 + ie6 的时候 这个bug依然存在

用监视器 发现鼠标进入的时候 依然会向服务器请求 hover.gif 文件,鼠标会在瞬间变成漏斗

测试代码如下,求高手解决。

HTML code

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
a {background-image:url(images/normal.gif);}
a:hover {background-image:url(images/hover.gif);}
html {filter:expression(document.execCommand("BackgroundImageCache", false, true));} 
</style>
<script language="javascript" type="text/javascript">
//document.execCommand("BackgroundImageCache", false, true);  [color=#FF0000]// CSS方法和JS方法均不起作用[/color]
</script>
</head>

<body>
<div style="background-color:#09C">
<a href="http://www.test1.com">TEST1</a>
<br />
<a href="http://www.test2.com">TEST2</a>
<br />
<a href="http://www.test3.com">TEST3</a>
</div>
</body>
</html>



------解决方案--------------------
body{background:url(about:blank) fixed}

样式里加上这句试试~·