大神,帮忙看下这段代码
jquery吧
全部回复
仅看楼主
level 1
yi旧孤单 楼主
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<script language="javascript">
function changeImg(obImg,sNewURL)
{
if(sNewURL!="") obImg.src=sNewURL;
}
</script>
<img style="cursor:hand;" src="images/1.jpg" border="0" width="50" height="30"
onmousedpwn="changeImg(this,'images/1.jpg');" onmouseup="changeImg(this,'images/2.jpg');">
<img style="cursor:hand;" src="images/3.jpg" border="0" width="50" height="30"
onmousedpwn="changeImg(this,'images/3.jpg');" onmouseup="changeImg(this,'images/4.jpg');">
</body>
</html>
2015年12月03日 09点12分 1
level 8
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="Generator" content="EditPlus®">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<title>Document</title>
</head>
<body>
<img style="cursor:pointer;" src="images/1.jpg" border="0" width="200" height="200" onClick="changeImg(this,'images/1.jpg','images/2.jpg')">
<script type="text/javascript">
function changeImg(a,b,c){
var res=a.getAttribute('src');//获取当前图片地址
if(res==b){
a.src=c;
}else{
a.src=b;
}
}
</script>
</body>
</html>
2015年12月03日 16点12分 4
3个参数比较容易些
2015年12月03日 16点12分
1