为什么鼠标移开时,会出现不停抖动
window.onload=function(){
var divv=document.getElementById("div1");
divv.onmouseover =function(){
startMove(10,0);
}
divv.onmouseout=function(){
startMove(-10,-200);
}
}
var timer=null;
function startMove(speed,Target){
clearInterval(timer);
divv=document.getElementById("div1");
setInterval(function(){
if (divv.offsetLeft == Target) {
clearInterval(timer);
}else{
divv.style.left=divv.offsetLeft+speed+'px';
}
},30)
}