如何将CSS代码鼠标经过图片变换?

有没有人在啊,想请讲解下,如何将CSS代码鼠标经过图片变换?
最新回答
樱の雪

2024-09-19 08:23:09

使用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;

}

深蓝菇凉

2024-09-19 18:41:02

<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;
}

欲往

2024-09-19 04:10:31

<img src="#" name="picture" width="330" height="210" border="0" align="middle" 

onMouseOver="this.src='#'" onMouseOut="this.src='#'">