第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時(shí)綁定郵箱和手機(jī)立即綁定

setTimeout里面第一行寫alert為什么不執(zhí)行?

function animate(ball,distence,cb){

setTimeout(function(){

alert(1) //為什么alert不執(zhí)行?

var marginLeft = parseInt(ball.style.marginLeft,10);


if(marginLeft === distence){

cb && cb();

}else{

if(marginLeft < distence){

marginLeft++;

}else{

marginLeft--

}

ball.style.marginLeft = marginLeft+'px';

animate(ball,distence,cb);

}

},13)

}


正在回答

2 回答

var ball1 = document.querySelector('.ball1');

var ball2 = document.querySelector('.ball2');

var ball3 = document.querySelector('.ball3');

function animate(ball,distence,cb){

setTimeout(function(){

alert(1) //為什么alert不執(zhí)行?

var marginLeft = parseInt(ball.style.marginLeft,10);


if(marginLeft === distence){

cb && cb();

}else{

if(marginLeft < distence){

marginLeft++;

}else{

marginLeft--

}

ball.style.marginLeft = marginLeft+'px';

animate(ball,distence,cb);

}

},13)

}


animate(ball1,100,function(){

animate(ball2,200,function(){

animate(ball3,300,function(){

animate(ball3,150,function(){

animate(ball2,150,function(){

animate(ball1,150,function(){

//

})

})

})

})

})

})

上下我都跟老師的一樣的,不會報(bào)錯(cuò)可以正常執(zhí)行,但是沒有alert()

0 回復(fù) 有任何疑惑可以回復(fù)我~

settimeout ?自啟 ?不執(zhí)行 ?沒理由的 ? ?要么就是報(bào)錯(cuò) 停止了 ? 要不你把上下代碼都貼出來看看

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
進(jìn)擊Node.js基礎(chǔ)(二)
  • 參與學(xué)習(xí)       76727    人
  • 解答問題       242    個(gè)

本教程帶你攻破 Nodejs,讓 JavaScript流暢運(yùn)行在服務(wù)器端

進(jìn)入課程

setTimeout里面第一行寫alert為什么不執(zhí)行?

我要回答 關(guān)注問題
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號