新手,帮忙看下为什么不动?
#div1{ width:200px; height:200px; position: absolute; left:-200px; top:200px; background:#369;}
#share{ width:30px; height:50px; position:absolute; left:200px; top:75px; background:#C06;}
</style>
<script type="text/javascript">
window.onload = function(){
var box=window.document.getElementById('div1');
box.onmouseover=function(){
startmove();
}
}
function startmove(){
var box=document.getElementById('div1');
setInterval(function(){
box.style.left= box.offsetLeft+speed+'px';
},30)
}
</script>
</head>
<body>
<div id="div1">
<span id="share">分享</span>
</div>
</body>
渣渣米