请大神看看为什么鼠标移出总是不停抖动
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
*{
margin:0;
padding:0;
}
#box{
position:relative;
left:-200px;
}
.one{
width:200px;
height:200px;
background-color:red;
float:left;
}
.two{
width:50px;
height:50px;
background-color:blue;
float:left;
margin-top:55px;
}
</style>
<script type="text/javascript">
window.onload=function(){
var odiv=document.getElementById("box");
odiv.onmouseover=function(){
starmove1(0)
}
odiv.onmouseout=function(){
starmove1(-200)
}
}
function starmove1(iTarget){
var timer;
clearInterval(timer);
var odiv=document.getElementById("box");
timer=setInterval(function(){
var speed;
if(odiv.offsetLeft>iTarget){
speed=-10;
}else{
speed=10
}
if(odiv.offsetLeft==iTarget){
clearInterval(timer);
}else{
odiv.style.left=odiv.offsetLeft+speed+"px";}
},30);
}
</script>
</head>
<body>
<div id="box">
<div class="one"></div>
<div class="two">分享</div>
</div>
</body>
</html>