課程
/前端開發(fā)
/Node.js
/進(jìn)擊Node.js基礎(chǔ)(二)
JS寫的那部分 不能直接瀏覽器打開嗎 ?為什么我的不動(dòng) 按照老師寫 ? 沒有用 什么open 命令行 ?我是window系統(tǒng) ? 直接瀏覽器打開
2017-11-09
源自:進(jìn)擊Node.js基礎(chǔ)(二) 1-2
正在回答
我用不用promise的寫法 只用js寫的 也是球不動(dòng) 報(bào)錯(cuò)是這個(gè)?var marginLeft = parseInt(ball.style.marginLeft,10) 但是不知道這個(gè)怎么錯(cuò)的
第 17 行:ball,style.marginLeft = marginLeft +'px'; 就是一個(gè)標(biāo)點(diǎn)符號(hào)的錯(cuò)誤,ball后面的逗號(hào),大哥,你手誤了
qq_懂我不言i_1
第四行 ?function animate(ball,distance,cb){...}里的ball,distance,cb三個(gè)參數(shù)去掉。
第八行 ?cb && cb() 換成 resolve()
初影_chaos
if(marginLeft === distance){
cb && cb()
}
你那里寫的三個(gè)等號(hào)
var ball1 =document.querySelector('.ball1')
var ball2 =document.querySelector('.ball2')
var ball3 =document.querySelector('.ball3')
function animate(ball,distance,cb){
setTimeout(function(){
var marginLeft = parseInt(ball.style.marginLeft,10)
else{
if(marginLeft < distance) {
marginLeft++
marginLeft--
ball,style.marginLeft = marginLeft +'px';
animate(ball,distance,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)
本教程帶你攻破 Nodejs,讓 JavaScript流暢運(yùn)行在服務(wù)器端
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號(hào)-11 京公網(wǎng)安備11010802030151號(hào)
購(gòu)課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號(hào)
2018-12-18
我用不用promise的寫法 只用js寫的 也是球不動(dòng) 報(bào)錯(cuò)是這個(gè)?var marginLeft = parseInt(ball.style.marginLeft,10) 但是不知道這個(gè)怎么錯(cuò)的
2018-08-03
第 17 行:ball,style.marginLeft = marginLeft +'px'; 就是一個(gè)標(biāo)點(diǎn)符號(hào)的錯(cuò)誤,ball后面的逗號(hào),大哥,你手誤了
2017-12-28
第四行 ?function animate(ball,distance,cb){...}里的ball,distance,cb三個(gè)參數(shù)去掉。
第八行 ?cb && cb() 換成 resolve()
2017-11-29
if(marginLeft === distance){
cb && cb()
}
你那里寫的三個(gè)等號(hào)
2017-11-09
var ball1 =document.querySelector('.ball1')
var ball2 =document.querySelector('.ball2')
var ball3 =document.querySelector('.ball3')
function animate(ball,distance,cb){
setTimeout(function(){
var marginLeft = parseInt(ball.style.marginLeft,10)
if(marginLeft === distance){
cb && cb()
}
else{
if(marginLeft < distance) {
marginLeft++
}
else{
marginLeft--
}
ball,style.marginLeft = marginLeft +'px';
animate(ball,distance,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(){
//
})
})
})
})
})
})