<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<!--页面有三张图,会周期性的轮播这三张图-->
</head>
<body>
<!-- 图片宽度要设置为100%,要不然可能会太长-->
<img id="img1" src="img/banner_1.jpg" width="100%">
<script>
var elementById = document.getElementById("img1");
var pt = 1;
function picRollFun(){
if (pt == 1){
elementById.src = "img/banner_2.jpg"
pt = 2;
}else if(pt ==2){
elementById.src = "img/banner_3.jpg"
pt = 3;
}else{
elementById.src = "img/banner_1.jpg"
pt = 1;
}
}
setInterval(picRollFun,3000);
elementById.cl
</script>
</body>
</html>