var imgList = document.getElementById('one').getElementsByTagName('li')var list = document.getElementById('two').getElementsByTagName('li')var index =0//全局变量,也是角标的索引var timer
for(var i =0; i < list.length; i++){
list[i].index = i
list[i].onmouseover=function(){var clickIndex =parseInt(this.index)
index = clickIndex
moveImg(imgList, index)moveIndex(list, index)clearInterval(timer)};
list[i].onmouseout=function(){play()//自动轮播淡入淡出}}varnextmove=function(){
index +=1if(index >=4){
index =0}moveImg(imgList, index)moveIndex(list, index)}varplay=function(){
timer =setInterval(function(){nextmove()},2000)}play()functionmoveImg(list, index){for(var i =0; i < list.length; i++){if(list[i].className =='show'){
list[i].className =''}}
list[index].className ='show'}functionmoveIndex(list, num){for(var i =0; i < list.length; i++){if(list[i].className =='on'){
list[i].className =''}}
list[num].className ='on'}