var imgArray = new Array("images/1.jpg", "images/2.jpg","images/3.jpg");
var index=0;
setInterval(function(){
$("img").attr("src",imgArray[index]);
if(index>=imgArray.length){
index=0;
}
else{
index++;
}
},1000);
转载于:https://www.cnblogs.com/annie211/p/5847237.html