我照抄了一遍第一次运行的代码,但无论哪个浏览器都无法实现功能
<head>
<style>
body,div,span{
margin:0;
padding:0;
}
#div1{
width:200px;
height:200px;
background:red;
position:relative;
left:-200px;
top:0px;
}
#div1 span{
width:20px;
height:50px;
background:blue;
position:absolute;
left:200px;
top:75px;
}
</style>
<script>
window.onload=function(){
var oDiv=document.getElementByld('div1');
oDiv.onmouseover=function(){
startMove();
}
}
function startMove()
{
var oDiv=document.getElementByld('div1');
setInterval(function(){
oDiv.style.left=oDiv.offsetLeft+10+'px';
},30)
}
</script>
</head>
<body>
<div id="div1"><span id="share">分享</span></div>
</body>
</html>