<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="imagetoolbar" content="no">
<title>js数组实现</title>
<style>
<!--
body{text-align:center;}
table{
border:0px;
}
.sp{
width:520px;
height:400px;
border:2px solid #FFCC00;
text-align:center;
line-height:400px;
}
.sn{
width:520px;
height:30px;
text-align:center;
line-height:30px;
}
img{
border:0px;
cursor:pointer;
}
-->
</style>
<script language="javascript">
<!--
var photo=new Array(4);
var photoname=new Array(4);
photo[0]="photo/1.jpg"
photoname[0]="柳梦璃"
photo[1]="photo/2.jpg"
photoname[1]="韩菱纱"
photo[2]="photo/3.jpg"
photoname[2]="云天河"
photo[3]="photo/4.jpg"
photoname[3]="慕容紫英"
currid=0
function showphoto(){
currid=currid+1;
if(currid>=4){
currid=0;
}
inphoto.src=photo[currid];
fn.innerHTML=photoname[currid];
}
-->
</script>
</head>
<body>
<table>
<tr>
<td class="sp"><img name="inphoto" src="photo/1.jpg" onclick="showphoto()" alt="点击图片显示下一张"></td>
</tr>
<tr>
<td class="sn"><span id="fn">柳梦璃</span></td>
</tr>
<tr>
<td class="sn">JS数组实现点击图片显示下一张</td>
</tr>
</table>
</body>
</html>
|