有个非常棘手的问题!样式表不能缓存已经下载过的图片。
每次onMouseOver或者onMouseOut时.c1和.c2的样式表的背景图片都要重新下载一次,非常别扭。我用JavaScript进行了图片预载后还是这样,请问有什么解决办法?
//-------- 代码 --------
<style>
.c1
{
WIDTH: 8;
BACKGROUND: url(./data.php?loc=images&filename=itemcard1_open_right.gif);
}
.c2
{
WIDTH: 20;
BACKGROUND: url(./data.php?loc=images&filename=itemcard1_open_across.gif);
}
.test1
{
BACKGROUND-COLOR: #C9C7DB;
BORDER-TOP: #302E42 1px solid;
BORDER-BOTTOM: #302E42 1px solid;
FONT-FAMILY: 宋体;
FONT-SIZE: 12pt;
COLOR: #000000;
CURSOR: hand;
}
.test2
{
BACKGROUND-COLOR: #FFFFFF;
BORDER-TOP: #302E42 1px solid;
BORDER-BOTTOM: #302E42 1px solid;
FONT-FAMILY: 宋体;
FONT-SIZE: 12pt;
COLOR: #000000;
CURSOR: hand;
}
<table>
<tr>
<td class='c1'><img width=0 height=0></td>
<td class='test1'
onMouseOver='this.className="test2"'
onMouseOut='this.className="test1"'>测试1</td>
<td class='c2'><img width=0 height=0></td>
<td class='c1'><img width=0 height=0></td>
<td class='test1'
onMouseOver='this.className="test2"'
onMouseOut='this.className="test1"'>测试1</td>
<td class='c2'><img width=0 height=0></td>
<td class='c1'><img width=0 height=0></td>
<td class='test1'
onMouseOver='this.className="test2"'
onMouseOut='this.className="test1"'>测试1</td>
<td class='c2'><img width=0 height=0></td>
<tr>
</table>