javascript 图片左右移动


<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<style type="text/css">
    body{width: 500px; margin: auto;}
    #pic1{width:235px; height:190px; padding-left: 0px;
position: absolute;left: 100px;
    }
</style>

<script>
function tion()
{
    var t=setTimeout("document.getElementById('pic1').style.left='100px';",100)
    var t=setTimeout("document.getElementById('pic1').style.left='200px';",200)
    var t=setTimeout("document.getElementById('pic1').style.left='300px';",300)
    var t=setTimeout("document.getElementById('pic1').style.left='400px';",400)
    var t=setTimeout("document.getElementById('pic1').style.left='500px';",500)
    var t=setTimeout("document.getElementById('pic1').style.left='600px';",600)
    var t=setTimeout("document.getElementById('pic1').style.left='700px';",700)
    var t=setTimeout("document.getElementById('pic1').style.left='800px';",800)
    var t=setTimeout("document.getElementById('pic1').style.left='900px';",900)
    var t=setTimeout("document.getElementById('pic1').style.left='800px';",1000)
    var t=setTimeout("document.getElementById('pic1').style.left='700px';",1100)
    var t=setTimeout("document.getElementById('pic1').style.left='600px';",1200)
    var t=setTimeout("document.getElementById('pic1').style.left='500px';",1300)
    var t=setTimeout("document.getElementById('pic1').style.left='400px';",1400)
    var t=setTimeout("document.getElementById('pic1').style.left='300px';",1500)
    var t=setTimeout("document.getElementById('pic1').style.left='200px';",1600)
    var t=setTimeout("document.getElementById('pic1').style.left='100px';",1700)
         
}
</script>
</head>
<body>
<h1>我的第一段 JavaScript</h1>
<img id="pic1" src="http://img4.duitang.com/uploads/blog/201311/23/20131123174811_s4uuc.jpeg"/>
<br/>
<button type="button" οnclick="tion()">点击这里</button>

</body>
</html>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值