为什么我的定时器清楚不了???
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style type="text/css">
#div1{width: 200px;height: 200px;background:red;position: relative;left: -200px;}
#div1 span{width: 20px;height: 50px;background: blue;position: absolute;left: 200px;top: 75px;}
</style>
<script type="text/javascript">
window.onload=function(){
var odiv=document.getElementById('div1');
odiv.onmouseover=function(){
startmove();
}
};
var timer=null;
function startmove(){
var odiv=document.getElementById('div1');
timer=setInterval(function(){
if(odiv.offsetLeft==0){
clearInterval(timer)
}else{odiv.style.left=odiv.offsetLeft+10+'px'}
},30);
}
</script>
</head>
<body>
<div id="div1">
<span id="share">分享</span>
</div>
</body>
</html>