帮忙看下为什么没反应

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>relative样式</title>
<style type="text/css">
*{margin:0;padding:0;}
#div1{
    width:200px;
    height:200px;
 background:red;
 position:relative;
    left:-100px;
    top:0px;
}
#share{
    width:50px;
    height:100px;
    background:blue;
    position:absolute;
    left:200px;
    top:50px;
}
   
   


</style>
<script type="text/javascript">
window.onload=function(){
 var oDiv=document.getElementById("div1")
 oDiv.onmouseover=function(){
  startMove()
 }
}
function startMove(){
 var oDiv=document.getElementById("div1")
 setInterval(function(){
  
  oDiv.style.left=oDiv.offsetLeft+10+'px'
 } 30)
}


</script>
</head>
<body>
 <div id="div1"><span id="share">move</span></div>
</body>
</html>

 

慕先生0450854
浏览 1332回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript