?window.onload=function(){
????var?wrap=document.getElementById('wrap'),
????????pic=document.getElementById('pic').getElementsByTagName('li'),
????????list=document.getElementById('list').getElementsByTagName('li'),
????????index=0,
????????timer=null;
??????//?定義并調(diào)用自動播放函數(shù)
timer?=?setInterval(autoPlay,1500);
??????//?定義圖片切換函數(shù)
????? function?changePic(curIndex){
for(var?i=0;i<pic.length;i++){
pic[i].style.display="none";
list[i].className="";
}
pic[curIndex].style.display="block";
list[curIndex].className="on";
}
?//設(shè)置自動播放函數(shù)(1~5循環(huán))
?function?autoPlay(){
?if(++index>=pic.length){index=0};
?changePic(index);}
?
?????//?鼠標(biāo)劃過整個容器時停止自動播放
wrap.onmouseover?=?function(){clearInterval(timer);}
?????//?鼠標(biāo)離開整個容器時繼續(xù)播放至下一張
???? wrap.onmouseout?=?function(){timer?=?setInterval(autoPlay,1500);}
?????//?遍歷所有數(shù)字導(dǎo)航實現(xiàn)劃過切換至對應(yīng)的圖片
for(var?i=0;i<=pic.length;i++){
list[i].onmouseover?=?function(){
clearInterval(timer);
index=this.innerText-1;
changePic(index);
};
};
???};
2016-05-20
n你想問的是什么呀?