<script language =javascript > var curIndex=0; //時間間隔 單位毫秒 var timeInterval=2000; var arr=new Array(); arr[0]="01.jpg"; arr[1]="02.jpg"; arr[2]="03.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> <img id=obj src ="1.jpg" border =0 />