chess.onclick = function (event) {var x = event.offsetX; var y = event.offsetY; var xb = (x-15)%30; var yb = (y-15)%30;if (xb>11&&xb<19||yb>11&&yb<19) {return;}var i = Math.floor(x/30); var j = Math.floor(y/30); if(chessBoard[i][j] == 0){ paintPieces(i,j,each);chessBoard[i][j] = each;each*=-1;}};
canvas{
display: block;
margin: 50px auto;
box-shadow: -20px -20px 20px #EFEFEF,5px 5px 5px #B9B9B9;
}
display: block;
margin: 50px auto;
box-shadow: -20px -20px 20px #EFEFEF,5px 5px 5px #B9B9B9;
}
2017-07-15