<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style>
.border{width: 400px;height: 100px;}
#pic1{height: 400px;width: 400px;}
.pic2{width: 90px;height: 90px;}
#PICU{width: 440px;left: 0px;padding:0px;margin:0px}
.LI1{
padding: 5px;
float: left;
width: 90px;
height: 90px;
list-style: none;
background-color: gray;
cursor: pointer;
}
</style>
</head>
<body>
<img id="pic1" src="img/1.jpg" onmouseover="Picstop();" onmouseout="Pgo()"/>
</div>
<div class="border">
<ul id="PICU">
<li class="LI1" onmouseover="Pstop(1);" onmouseout="Pgo()" style="background-color: red;"><img class="pic2" src="img/1.jpg" ></li>
<li class="LI1" onmouseover="Pstop(2);" onmouseout="Pgo()"><img class="pic2" src="img/2.jpg" ></li>
<li class="LI1" onmouseover="Pstop(3);" onmouseout="Pgo()"><img class="pic2" src="img/3.jpg" ></li>
<li class="LI1" onmouseover="Pstop(4);" onmouseout="Pgo()"><img class="pic2" src="img/4.jpg" ></li>
</ul>
</div>
<script>
var n=0;
var showImg =document.getElementById("pic1");
var picNum=document.getElementsByClassName("LI1");
console.log(picNum[0]);
window.onload = function(){
inter = window.setInterval("change()",1500);
}
function change(){
if(n==4){
picNum[n-1].style.backgroundColor="gray";
n=0;
}
for(var a=1;a<5;a++){
if(a!=(n))picNum[a-1].style.backgroundColor="gray";
}
showImg.src='img/'+(n+1)+'.jpg';
if(n>0)picNum[n-1].style.backgroundColor="gray";
picNum[n].style.backgroundColor="red";
n++;
}
function Picstop(){
window.clearInterval(inter);
}
function Pstop(i){
console.log(i);
picNum[i-1].style.backgroundColor="red";
for(var a=1;a<5;a++){
if(a!=(i))picNum[a-1].style.backgroundColor="gray";
}
showImg.src='img/'+i+'.jpg';
window.clearInterval(inter);
}
function Pgo(){
inter = setInterval("change()",1500);
}
</script>
</body>
</html>
效果如下:

gifhome_520x644_4s.gif