为什么结果没出来,都没有反应
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JS动画2</title>
<style type="text/css">
*{margin: 0;
padding: 0;
}
#share{
width: 200px;
height: 200px;
background-color:#11FA45 ;
position: relative;
left: -200px;
}
#share span{
width: 60px;
height: 50px;
line-height: 50px;
background-color: #F36812;
position: absolute;
text-align: center;
top:100px;
right: -60px;
}
</style>
</head>
<body>
<div id="share">
<span>分享</span>
</div>
<script type="text/javascript">
window.onload=function(){
var move=document.getElementById("share");
move.onmouseover=function(){
startmove();
}
}
var timer=null;
function startmove(){
clearInterval(timer);
var move=document.getElementById("share");
timer=setInterval(function(){
if (move.offsetLeft>=0) {
clearInterval(timer);
} else{
move.style.left=move.offsetLeft+10+'px';}
},30)
}
</body>
</script>
</html>