<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<script>
window.onload=function () {
var i = 0;
var next = document.getElementById('next');
var oImg = document.getElementById('img')
var aImg = ["images/1.jpg","images/2.jpg","images/3.jpg","images/4.jpg"];
next.onclick = function () {
banner();
}
banner = function () {
i++;
if (i == aImg.lenght) {
i = 0;
}
oImg.src = aImg[i];
}
}
</script>
</head>
<body>
<div id="box">
<a href="javascript:;" id="prev"><</a>
<a href="javascript:;" id="next">></a>
<img src="images/1.jpg" id="img">
</div>
</body>
</html>
添加回答
举报
0/150
提交
取消