就是在Startmove的方法里寫的第一個關(guān)閉計(jì)時(shí)器有什么用
function statmove()
{clearInterval(timer);//一直沒明白這是待變什么意思
var odiv2=document.getElementById('div1');
setInterval(function(){
if(odiv2.offsetLeft==0){
clearInterval(timer);
}
else
{
}odiv2.style.left=odiv2.offsetLeft+1+'px';
},30)
}
2018-04-01
每次鼠標(biāo)移入移出時(shí)先關(guān)閉定時(shí)器,然后再根據(jù)下面的條件決定是否重新開啟一個定時(shí)器.