一.让div动起来 var oBtn = document.getElementById('btn1'); var timer='';//设置定时器 oBtn.onclick=function startMove(){ var oDiv = document.getElementById('div1'); clearInterval(timer);//关闭原有的定时器,否则多个定时器会叠加 timer=setInterval(function(){ var iSpeed=3; if(oDiv.…