按老师做的,在已经有落子的地方点一下,再点击空白地方,颜色变了,怎么搞
chess.onclick = function(e){
var x = e.offsetX;
var y = e.offsetY;
var i = Math.floor(x/30);
var j = Math.floor(y/30);
if(chessBoard[i][j]==0){
oneStep(i,j,me);
if(me){
chessBoard[i][j] = 1;
}else{
chessBoard[i][j] = 2;
}
}
me = !me;
}