请问哪里错了呢?为什么offsetleft=0的时候还不停呢?
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script>
window.onload=function(){
var rtt=document.getElementById("tt");
rtt.onmouseover=function(){
startmove();
}
}
function startmove(){
var timer=null;
var rtt=document.getElementById("tt");
timer = setInterval(function(){
if(rtt.offsetLeft == 0){
clearInterval(timer);
}
else{
rtt.style.left=rtt.offsetLeft+10+"px"
}
},30)
}
</script>
</head>
<body>
<div id="tt" style="width: 500px; height: auto; position: absolute; left: -468px; top: 217px;"><img src="tt.jpg" style="width:500px"></div>
</body>
</html>