自动滚动相册小程序

<html>
<head>
<meta charset="utf-8"/>
<style type="text/css">
*{margin:0;padding:0;border:0}
#main{width:450px;height:400px;background-color:green;margin:auto}
#head{height:350px;background-color:blue}
#head img{width:440px;height:340px;padding-left:5px;padding-top:5px}
#content li{list-style:none;float:left;width:35px;height:30px;border:1px solid orange;text-align:center;line-height:30px;margin-top:8px}
#content ul{width:360px;margin:auto;margin-right:5px;}
</style>
</head>


<body οnlοad="startmove()">
<div id="main">
<div id="head">
<img src="./1.jpg" id="a1"/>
</div>
<div id="content">
<ul>
<li id="q1" οnmοuseοver="stopmouse(1)" οnmοuseοut="startmove(1)">1</li>
<li id="q2" οnmοuseοver="stopmouse(2)" οnmοuseοut="startmove(2)">2</li>
<li id="q3" οnmοuseοver="stopmouse(3)" οnmοuseοut="startmove(3)">3</li>
<li id="q4" οnmοuseοver="stopmouse(4)" οnmοuseοut="startmove(4)">4</li>
<li id="q5" οnmοuseοver="stopmouse(5)" οnmοuseοut="startmove(5)">5</li>
<li id="q6" οnmοuseοver="stopmouse(6)" οnmοuseοut="startmove(6)">6</li>
<li id="q7" οnmοuseοver="stopmouse(7)" οnmοuseοut="startmove(7)">7</li>
<li id="q8" οnmοuseοver="stopmouse(8)" οnmοuseοut="startmove(8)">8</li>
</ul>
</div>
</div>
</body>
<script type="text/javascript">
var count = 1;
var interId;
function changePic(){
var img = document.getElementById('a1');
if(count == 9){
count = 1;
}
img.src = count+'.jpg';
for(var i=1;i<=8;i++){
document.getElementById('q'+i).style.backgroundColor = '';
}
document.getElementById('q'+count).style.backgroundColor = 'yellow';
count++;
}
function startmove(){
interId = setInterval("changePic()",1000);
}
function stop(){
clearInterval(interId)
}
function stopmouse(n){
stop();
var img = document.getElementById('a1');
img.src = n+'.jpg';
for(var i=1;i<=8;i++){
document.getElementById('q'+i).style.backgroundColor = '';
}
document.getElementById('q'+n).style.backgroundColor = 'yellow';
count=n;
}
</script>
</html>
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值