<script language =javascript >
var curIndex=0;
//时间间隔 单位毫秒
var timeInterval=2000;
var arr=new Array();
arr[0]="QQ20181206-0.jpg";
arr[1]="QQ20181206-3.jpg";
arr[2]="QQ20181206-4.jpg";
setInterval(changeImg,timeInterval);
function changeImg()/*调用函数*/
{
var obj=document.getElementById("obj");/*获取元素*/
if (curIndex==arr.length-1)
{
curIndex=0;
}
else
{
curIndex+=1;
}
obj.src=arr[curIndex];
}
</script>
网友评论