Position setzen

 

 

JavaScript

var board = new ChessBoard('board');

$('#setStartBtn').on('click', board.start);

$('#setRuyLopezBtn').on('click', function() {
  board.position('r1bqkbnr/pppp1ppp/2n5/1B2p3/4P3/5N2/PPPP1PPP/RNBQK2R');
});

$('#setRookCheckmateBtn').on('click', function() {
  board.position({
    a4: 'bK',
    c4: 'wK',
    a7: 'wR'
  });
});

HTML

<div id="board" style="width: 400px"></div>
<input type="button" id="setStartBtn" value="Start Position" />
<input type="button" id="setRuyLopezBtn" value="Ruy Lopez" />
<input type="button" id="setRookCheckmateBtn" value="Rook Checkmate" />