复制代码 代码如下: images <BR> var curIndex = 0; <BR> var timeInterval = 1000; <BR> var arr = new Array(); <BR> arr[0] = "1 (1).jpg"; <BR> arr[1] = "1 (2).jpg"; <BR> arr[2] = "1 (3).jpg"; <BR> arr[3] = "1 (4).jpg"; <BR> arr[4] = "1 (5).jpg"; <BR> arr[5] = "1 (6).jpg"; <BR> arr[6] = "1 (7).jpg"; <BR> arr[7] = "1 (8).jpg";<BR> setInterval(changeImg,timeInterval); <BR> function changeImg() { <BR> var obj = document.getElementById("obj"); <BR> if (curIndex == arr.length-1) { <BR> curIndex = 0; <BR> } else { <BR> curIndex += 1; <BR> } <BR> obj.src = arr[curIndex]; <BR> } <BR> <BR> setInterval(test,1000); <BR> var array = new Array(); <BR> var index = 0; <BR> var array = new Array("1 (1).jpg","1 (2).jpg","1 (3).jpg","1 (4).jpg","1 (5).jpg","1 (6).jpg","1 (7).jpg","1 (8).jpg"); <BR> function test() { <BR> var myimg=document.getElementById("imgs"); <BR> if(index==array.length-1) <BR> { index=0; }else{ index++; } <BR> myimg.src=array[index]; <BR> } <BR>