为什么鼠标移动到方块上不会移动
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>缓冲动画</title>
<style type="text/css">
div body{
margingin:0;
padding:0;
}
#div1{
width:250px;
height:200px;
background:red;
position:relative;top:0px;left:-200px;
}
</style>
<script>
window.onload=function{
oDiv = document.getElementById("div1");
oDiv.onmouseover = function(){
startMove(0);
}
oDiv.onmouseout = function(){
startMoove(-200);
}
}
var timer = null;
function startMove(iTarget){
clearInterval(timer);
var oDiv = document.getElementById("div1");
timer = setInterval(function(
var speed = 0;
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="div1"></div>
</body>
</html>