<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
.div1{
width:600px;
height:300px;
border:5px solid green;
padding: 5px;
}
h1{
text-align: center;
}
img{
width:400px;
height:200px;
}
.div2{
width:400px;
height:200px;
margin-top:10px;
margin-left: 100px;
border:5px solid yellow;
}
</style>
<script>
var i=[];
i.push("img/hot.jpg");
i.push("img/p.jpg");
i.push("img/r.jpg");
i.push("img/y.jpg");
i.push("img/r.jpg");
var x=0;
function btu(){
var s=document.getElementById("img");
s.src=i[x];
x++;
while(x==i.length){
x=0;
}
}
</script>
</head>
<body>
<div class="div1">
<h1>Image</h1>
<div class=div2>
<img src="img/b.jpg" id="img">
</div>
<div>
<h1><button Onclick="btu()">下一张</button></h1>
</div>
</div>
</body>
</html>
图片