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