定时器没起到作用啊???、
<!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">
#div1{ background-color:#000;
position:relative;
width:200px;
height:200px;
left:-200px;
}
#div1 span{
background-color: #C0F;
display:inline-block;
position:absolute;
width: 80px;
height::50px;
left:200px;
top:86px;
}
</style>
<script type="text/javascript">
window.onload=function(){
var odiv1= document.getElementById('div1');
odiv1.onmousemove=function(){
starMove();
}
}
var timer=null;
function starMove(){
clearInterval(timer);
var odiv1= document.getElementById("div1");
timer= setInterval(function(){
if(odiv1.offsetLef ==0){
clearInterval(timer);
}
else{
odiv1.style.left=odiv1.offsetLeft+1+'px';
}
},30);
}
</script>
</head>
<body>
<div id="div1"><span>share</span></div>
</body>
</html>