<script language =javascript >
var curIndex=0;
//时间间隔 单位毫秒
var timeInterval=2000;
var arr=new Array();
arr[0]="images/1.jpg";
arr[1]="images/2.jpg";
arr[2]="images/3.jpg";
arr[3]="images/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>
<center>
<img id=obj src ="images/1.jpg" height="450" width="1920" border =0 title="默认图片"/>
</center>
上一篇: 固定底部一键拨号代码-只在手机端显示代码 下一篇:三种让网页变灰的css代码