帮忙看一下,出来可以,但就是回不去,回去时一直弹跳收不回,谢谢啦
<!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>
#divxx{ width:200px; height:200px; position: absolute; left:-200px; top:200px; background:#369;}
#divxx #share{ width:30px; height:50px; position:absolute; left:200px; top:75px; background:#C06;}
</style>
</head>
<body>
<div id="divxx">
<span id="share">分享</span>
</div>
</body>
</html>
<script type="text/javascript">
var box = document.getElementById('divxx');
box.onmouseover = function(){
startMove(10,0);
}
box.onmouseout = function(){
startMove(-10,-200);
}
var timer = null;
function startMove(speed,iTarget){
clearInterval(timer);
setInterval(function(){
if(box.offsetLeft ==iTarget){
clearInterval(timer);
}
else{
box.style.left= box.offsetLeft+speed+'px';
}
},30)
}
</script>