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

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

為啥出不來兩個(gè)隨機(jī)數(shù)呀,代碼對(duì)了挺多遍感覺沒有問題呀,有沒有大神幫忙看看,


main.js

var board=new Array();
var score=0;

$(document).ready(function(e){
? newgame();

});

function newgame(){
?//初始化
?init();
?//在隨機(jī)的兩個(gè)格子里生成數(shù)字
?generateNumber();
?generateNumber();
}

function init(){
?for(var i=0;i<4;i++)
?{
??for(var j=0;j<4;j++)
??? {
??? ?var cell=$('#cell-'+i+'-'+j);
??? ?cell.css("top",gettop(i,j));
??? ?cell.css("left",getleft(i,j));
??? }

?}

?for(var i=0;i<4;i++)
?{
?????? board[i]=new Array();
????????? for(var j=0;j<4;j++)
??? ?? board[i][j]=0;
??? }

??? updateboard();
???
}


function updateboard(){
?//$("numbur-cell").remove();
?for (var i = 0; i <4; i++) {
???? for(var j=0;j<4;j++){
???? ?$("#container").append(
???? ??'<div class="numbur-cell"? id=" numbur-cell- '+i+' - '+j+' "> </div>'
???? ??);
???? ?var theNumbercell=$('#number-cell-'+i+'-'+j);

???? ?if (board[i][j]==0) {
???? ??theNumbercell.css('width','0px');
???? ??theNumbercell.css('height','0px');
???? ??theNumbercell.css('left',getleft(i,j)+50);
???? ??theNumbercell.css('top',gettop(i,j)+50);

???? ?}
???? ?else{
???? ??theNumbercell.css('width','100px');
???? ??theNumbercell.css('height','100px');
???? ??theNumbercell.css('left',getleft(i,j));
???? ??theNumbercell.css('top',gettop(i,j));
???? ??theNumbercell.css('background-color',getNumberBKcolor(board[i][j]));
???? ??theNumbercell.css('color',getNumbercolor(board[i][j]));
???? ??theNumbercell.text(board[i][j]);?
???? ?}

???? }
?}
}


function generateNumber(){
? if (nospace(board))
??? return false;

?//確定位置
?? var x= parseInt(Math.floor(Math.random() * 4));
??? var y= parseInt(Math.floor(Math.random() * 4));
??? while (true){
??????? if (board[x][y]==0){
??????????? break;
??????? }
??????? x= parseInt(Math.floor(Math.random() * 4));
??????? y= parseInt(Math.floor(Math.random() * 4));
??? }
?//確定數(shù)字
?var Rnumber=Math.random()<0.5?2:4;
?
?//顯示數(shù)字
?board[x][y]=Rnumber;
?showNumber(x,y,Rnumber);


??? return true;
?
}


animate.js

function showNumber(i,j,Rnumber){
?var Numbercell=$('#number-cell-'+i+'-'+j);

?Numbercell.css("background-color",getNumberBKcolor(Rnumber));
?Numbercell.css("color",getNumbercolor(Rnumber));
?Numbercell.text(Rnumber);

?Numbercell.animate({
??width:"100px",
???? height:"100px",
???? left:getleft(i,j),
???? top:gettop(i,j)
?},50);

}

檢查過,沒有報(bào)錯(cuò)

正在回答

3 回答

活該哈哈哈哈

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

還有你的nosace函數(shù)我沒看到啊

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

半生不熟_

nospace
2020-12-09 回復(fù) 有任何疑惑可以回復(fù)我~

updateboard方法,為什么要注釋掉$("numbur-cell").remove()?

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

慕慕0006434

因?yàn)樗緛砭蜎]有啊,這個(gè)是檢測(cè)的啊
2020-05-26 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

為啥出不來兩個(gè)隨機(jī)數(shù)呀,代碼對(duì)了挺多遍感覺沒有問題呀,有沒有大神幫忙看看,

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

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

幫助反饋 APP下載

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

公眾號(hào)

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