轮播图

1.jpg

2.jpg

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>轮播图</title>
		<script>
			var number =1;
			 function fun(){
				number ++;
				if(number>2){
					number=1;
				}
				var img =document.getElementById("img");
			img.src = number+".jpg";
			}
			setInterval(fun,3000);
		</script>
	</head>
	<body>
		<img id="img" src="1.jpg" width="90%">
	</body>
</html>
posted @ 2021-06-07 21:53  -筱  阅读(12)  评论(0编辑  收藏  举报