<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=GBK" />
<title></title>
//8张图片1.png2.png3.png.............
<script type = "text/javascript">
var now = 1;
function changeImg(which){
var img = document.getElementById("images");
if(which == 'pre'){
now--;
if(now < 1){
now = 8;
img.src = now+".png"
}
img.src = now+".png";
}else{
now++;
if(now > 8){
now = 1;
img.src = now+".png";
}
img.src = now+".png";
}
}
</script>
</head>
<body>
<div id = "changeImg">
<img id = "images" src = "1.png"/>
</div>
<div>
<input type = "button" value = "上一张" onclick = "changeImg('pre')"/>
<input type = "button" value = "下一张" onclick = "changeImg('next')"/>
</div>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=GBK" />
<title></title>
//8张图片1.png2.png3.png.............
<script type = "text/javascript">
var now = 1;
function changeImg(which){
var img = document.getElementById("images");
if(which == 'pre'){
now--;
if(now < 1){
now = 8;
img.src = now+".png"
}
img.src = now+".png";
}else{
now++;
if(now > 8){
now = 1;
img.src = now+".png";
}
img.src = now+".png";
}
}
</script>
</head>
<body>
<div id = "changeImg">
<img id = "images" src = "1.png"/>
</div>
<div>
<input type = "button" value = "上一张" onclick = "changeImg('pre')"/>
<input type = "button" value = "下一张" onclick = "changeImg('next')"/>
</div>
</body>
</html>