ASDDSAFAS
2017-07-04 19:56
麻烦看一下哪里错了,谢谢
<!DOCTYPE html>
<html>
<head>
<script src="http://libs.baidu.com/jquery/1.9.1/jquery.js"></script>
<meta charset="UTF-8">
<title>JS速度动画</title>
<style type="text/css">
body,ul,ol,li,p,h1,h2,h3,h4,h5,h6,form,fieldset,table,td,img,div,dl,dt,
dd,input{margin:0;padding:0;}
body{font-size:12px;}
img{border:none;}
li{list-style:none;}
input,select,textarea{outline:none;}
textarea{resize:none;}
#div1{
height: 200px;
width: 200px;
background-color: red;
position: relative;
left: -200px;
top: 0;
}
#div1 span{
background-color: blue;
width:20px;
height: 50px;
position: absolute;
left: 200px;
top: 75px;
}
</style>
<script type="text/javascript">
window.onload=function(){
var oDiv=document.getElementById('div1');
oDiv.onmouseover=function(){
startMove();
}
}
function startMove() {
var oDiv=document.getElementById('div1');
setInterval(function(){
oDiv.style.left=oDiv.OffsetLeft+10+'px';
},30)
}
</script>
</head>
<body>
<script type="text/javascript">
</script>
<div id="div1" ><span id="share">分享</span></div>
</body>
</html>
offsetLeft 拼错了
JS动画效果
113925 学习 · 1443 问题
相似问题
回答 1
回答 6
回答 2
回答 2
回答 2