如何将CSS代码鼠标经过图片变换?
使用jquery的toggle方法进行图片切换:
$(function(){
$("#h1").toggle(function(){
$("#h1").css("background-image","路径('./20110528073501b54e6.jpg')");
},function(){
$("#h1").css("background-image","路径('./2011060708410874041.jpg')");
})
})
<input type="button" value="huan" id="h1" class="hh1" />
CSS
.hh1{
background: url("./2011060708410874041.jpg");
width: 120px;
height: 90px;
}
<img src="#" name="picture" width="330" height="210" border="0" align="middle"
onMouseOver="this.src='#'" onMouseOut="this.src='#'">
使用jquery的toggle方法进行图片切换
$(function(){
$("#h1").toggle(function(){
$("#h1").css("background-image","路径('./20110528073501b54e6.jpg')");
},function(){
$("#h1").css("background-image","路径('./2011060708410874041.jpg')");
})
})
<input type="button" value="huan" id="h1" class="hh1" />
CSS
.hh1{
background: url("./2011060708410874041.jpg");
width: 120px;
height: 90px;
}
<img src="#" name="picture" width="330" height="210" border="0" align="middle"
onMouseOver="this.src='#'" onMouseOut="this.src='#'">