搜尋

首頁  >  問答  >  主體

載入js檔案失敗了

var board = new Array();

$(document).ready() {

newgame();

}


#function newgame() {

init();

generateOneNumber();

generateOneNumber();

}


##function init() {

alert("sdf");

for (var i = 0; i < 4 ; i ) {

borad[i] = new Array();

for (var j = 0; j < 4; j ) {

板[i ][j ] = 0;


## var gridCell = $("#grid-cell-" i "-" j);

gridCell.css ("top" , getPostTop(i, j));

gridCell.css("left", getPostLeft(i, j));

## }

# }

# updateBoardview();

}

#function updateBoardview() {

for (var i = 0; i < 4; i ) {

# for (var j = 0; j < 4; j ) {

# $ ("#grid-container").append("

");

# var numberCell = $("#number-cell-" i "-" j);

if (板[i][j]) {

# numberCell.css("寬度", 0 px);

numberCell.css("高度", 0 px);

numberCell.css("頂部" , getPostTop(i, j ) 100);

numberCell.css("left", getPostLeft(i, j) 100);

} else {

numberCell. css("寬度", 100 px);

numberCell.css("高度", 100 px);

numberCell.css("頂部", getPostTop(i, j));

numberCell.css("left", getPostLeft(i, j));

# numberCell.css("background-color", getNumberBackgroundColor(board[i][j]));

numberCell.css("color", getNumbercolor(board[i][j]));

numberCell.text(board[i][j]);

}

}

}

##}


##functiongenerateOneNumber( ) {


# var randx = parseInt(Math.floor(Math.random() * 4));

var randy = parseInt(Math.floor(Math.random() * 4)) );

當(true) {

if (board[randx][randy] == 0) {

中斷;

## }

var randx = parseInt(Math.floor(Math.random() * 4));

var randy = parseInt(Math.floor(Math.random() * 4));

# }

var randNumber = Math.random() < 0.5? 2 : 4;

板[randx][randy] = randNumber;

showNumberWithAnimation(randx, randy, randNumber);

}

MemoryMemory2430 天前1439

全部回覆(1)我來回復

  • 韦小宝

    韦小宝2018-03-30 20:12:33

    f12看看報什麼錯,載入失敗可能就是路徑錯了,檢查一下路徑看看

    回覆
    0
  • 取消回覆