我有3张图片在彼此之上。第一个是普通的.jpg图像,第二个是灰度版本,第三个是某种效果,我添加了透明.png显示隐藏图片onmouseover
现在我想要的是,如果将鼠标移动到这些图像上,灰度图像被隐藏或被另一图像取代,然后再次可见。
这里的问题是,我是一个JS小白,所以它是一种对我来说很难找到解决办法^^
我的代码看起来是这样的:
<html>
<head>
<style type="text/css">
<!--
ul li{
display: inline-table;
}
.frame{
position: relative;
height: 110px;
width: 110px;
}
.frame div{
position: absolute;
top:0px;
left:0px;
}
.effect{
background:url(images/effect.png) no-repeat;
height:110px;
width: 110px;
}
.image{
height:100px;
width:100px;
border: 1px solid red;
margin:4px;
}
.greyscale{
height:100px;
width:100px;
border: 1px solid red;
margin:4px;
}
-->
</style>
</head>
<body>
<ul>
<li>
<div class="frame">
<div class="image"><img src="images/pic1.jpg" height="100" width="100"></div>
<div class="greyscale"><img src="images/grey1.jpg" height="100" width="100"></div>
<div class="effect">qwert</div>
</div>
</li>
<li>
<div class="frame">
<div class="image"><img src="images/pic2.jpg" height="100" width="100"></div>
<div class="greyscale"><img src="images/grey2.jpg" height="100" width="100"></div>
<div class="effect">qewrt</div>
</div>
</li>
</ul>
</body>
</html>
会超真棒,如果有人能帮助我了:)
[试试这个模拟器问题](http://stackoverflow.com/questions/9400883/change-image-on-hover/9428063#9428063) – 2012-03-05 11:52:05