图片切换,鼠标经过停止,鼠标移开继续切换图片的JS功能,应该怎么样做?
<scripttype="text/javascript">varcurIndex=0;vartimeInterval=2000;vararr=newArray;arr[...
<script type="text/javascript">
var curIndex=0;
var timeInterval=2000;
var arr=new Array;
arr[0]="photos/1.jpg";
arr[1]="photos/2.jpg";
arr[2]="photos/3.jpg";
arr[3]="photos/4.jpg";
var changeStop=setInterval(changeImg,timeInterval);
function changeImg()
{
var obj=document.getElementById("obj");
if(curIndex==arr.length-1)
{
curIndex=0
}
else
{
curIndex+=1;
}
obj.src=arr[curIndex];
obj1.href=arr1[curIndex];
}
</script>
<div>
<a id="obj1" href="http://www.701dx.com" target="blank"><img id="obj"
src="photos/1.jpg" alt="" style="border:none;" onmouseover="clearInterval
(changeStop);"></a> 展开
var curIndex=0;
var timeInterval=2000;
var arr=new Array;
arr[0]="photos/1.jpg";
arr[1]="photos/2.jpg";
arr[2]="photos/3.jpg";
arr[3]="photos/4.jpg";
var changeStop=setInterval(changeImg,timeInterval);
function changeImg()
{
var obj=document.getElementById("obj");
if(curIndex==arr.length-1)
{
curIndex=0
}
else
{
curIndex+=1;
}
obj.src=arr[curIndex];
obj1.href=arr1[curIndex];
}
</script>
<div>
<a id="obj1" href="http://www.701dx.com" target="blank"><img id="obj"
src="photos/1.jpg" alt="" style="border:none;" onmouseover="clearInterval
(changeStop);"></a> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询