标签:轮播 interval int ntb logo 定时器 func ++ src
window.onload=function () { var alogo =document.getElementById("logo") var aa = ["./img/cd3e871466f03e864f08e12cd372bcc9.jpeg", "./img/b27b4f1f0b212f503cbb24011dc8f7e6.jpeg", "./img/0bda20a27b83f7e25665b48736f3264b.jpeg", "./img/88442c2c2f87a4737ddc2305113b66ab.jpeg", "./img/40a457585714d439acca2085a1e32a07.jpeg", "./img/8ffc1b07c66ecaf530e3bc613551d1f7.jpeg", "./img/cd3e871466f03e864f08e12cd372bcc9.jpeg" ]; //定义bb为id 为“lb1”的div var bb = document.getElementById(‘abpicimg‘); var i = 0; setInterval(function(){ //运行一次i+1 i++; //如果i等于aa数组的长度时让i=0 if(i==aa.length){ i=0; } //让bb等于aa【i】 bb.src=aa[i]; //两秒钟轮播一次 },2000);
标签:轮播 interval int ntb logo 定时器 func ++ src
原文地址:https://www.cnblogs.com/LQK157/p/11027558.html