<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<div onmouseover="zanting()" onmouseout="kaishi()">
<img id="imgx" src="./img/2.png" />
</div>
</body>
<script>
var arr=["./img/2.png","./img/3.png","./img/9.jpg"];
var i=0;
function qie(){
i++;
document.getElementById("imgx").src=arr[i]
if(i>=2){
i=0;
}
}
var x=setInterval(qie,1000);
function zanting(){
clearInterval(x);
}
function kaishi(){
x=setInterval(qie,1000);
}
</script>
</html>
轮播图(简单)
最新推荐文章于 2024-06-21 16:41:46 发布