制作网页轮播效果最简便的代码方式,希望萌新们能用到
<body onload="imgMove()"> <div id="div1"> <img src="下载图片/18370029_980x1200_0.jpg" alt="" width="1200" id="picture"/> </div> </body> <script type="text/javascript"> var arr=new Array(); arr[0]="下载图片/18370029_980x1200_0.jpg"; arr[1]="下载图片/63d0f703918fa0ec7e56fedf2c9759ee3c6ddb4b.jpg"; arr[2]="下载图片/9a504fc2d56285352b9a48ca9aef76c6a6ef63e7.jpg"; arr[3]="下载图片/a0a3k908338577213596.jpg"; var i=0; //轮播移动的函数 function imgMove() { var imgs=document.getElementById("picture"); imgs.src=arr[i]; i++; if (i==4) { i=0; } setTimeout("imgMove()",2000); } </script>