完成图片切换功能
<style>
.div{
width: 800px;
height: 600px;
}
.btn{
width: 120px;
height: 60px;
align-content: center;
}
.divcss5{margin:0 auto}
</style>
</head>
<body>
<div class="div divcss5"><img src="cankao/0.jpg" width="800"></div><br/>
<div >
<button class="btn" onclick="qiehuan()">切换</button>
</div>
</body>
<script>
var i=0;
function qiehuan() {
i++;
if(i==6){
i=0;
}
var img=document.querySelector("img")
img.src="cankao/"+i+".jpg"
}
</script>