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;
}
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;
}
};
//备注:你的问题是 me!=me 位置错了!应该在 oneStep 方法调用后 改变 me!=me !
海贼头像很帅气吗!