通过计时器实现图片轮播

时间:2024-11-18 12:51:41
<html> <head> <meta charset="utf-8" /> <title></title> <style type="text/css"> #container{width: 524px; height: 190px;margin: 10px auto;border: 3px solid palegreen;} </style> <script type="text/javascript"> var index=1; =function(){ setInterval("showimage()",1000); } function showimage(){ var img=("img")[0]; index++; if(index>4){ index=1; } ="image/ad-0"+index+".jpg"; } </script> </head> <body> <div id="container"> <img src="image/" /> </div> </body> </html>