js动态切换图片

<script language =javascript >
$(function () {
initAds(); });
function initAds() {
var curIndex = 0;
var timeInterval = 2500;
var arr = new Array();
arr[0] = "../../Resource/img/lizi/ad-img1.png";
arr[1] = "../../Resource/img/lizi/ad-img2.png";
arr[2] = "../../Resource/img/lizi/ad-img3.png";
setInterval(changeImg, timeInterval);
function changeImg() {
var obj11 = document.getElementById("obj");
if (curIndex == arr.length - 1) {
curIndex = 0;
}
else {
curIndex += 1;
}
obj11.src = arr[curIndex];
}
} </script>
上一篇:吴恩达机器学习笔记8-多变量线性回归(Linear Regression with Multiple Variables)--多维特征


下一篇:免费素材:包含 250+ 组件的 DO UI Kit