标签:tin change 完成 ble ++ 首页轮播 script interval 代码
HTML核心代码
确定事件:onload 加在body里面! <body onload="init()">
给指定的图片位置定义一个id <img src="../img/1.jpg" width="1300px" id="img1"/>
|
JS的核心代码 <script> function init(){ setInterval("changeImg()",3000); }
var i=1; function changeImg(){ i++; var imgEl = document.getElementById("img1"); imgEl.src="../img/"+i+".jpg"; if(i==3){ i=0; } }
</script> |
标签:tin change 完成 ble ++ 首页轮播 script interval 代码
原文地址:http://www.cnblogs.com/hhg-index/p/7783154.html