My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads
Links

Latest News

6 Jun 2010

jsChessboard 0.2.0 has been released. Download here.

18 Mar 2009

jsChessboard 0.1.0 has been released. Download here.

What is jsChessboard ?

jsChessboard is a JavaScript library designed to programmatically display chessboard diagrams in web pages or web applications.

jsChessboard knows chess notation therefore jsChessboard can interpret a sequence of chess moves in algebraic notation from a given position and draw the new position.

Supported browsers

Most browsers supporting the <canvas> HTML tag are supported by jsChessboard.

  • Mozilla Firefox (3.0+)
  • Safari
  • Google Chrome / Chromium (4.0+)
  • Opera (10+)

Demo

Getting started

Preparing the HTML

Add the script headers for jsChessboard to work.

<script type="text/javascript" src="chessboard.js"></script>

Then add a <canvas> where you want the chessboard diagram to appear. Note that the canvas element width and height must have the same value.

<canvas id="myboard" width="300" height="300"></canvas>

JavaScript

Add this inline script in your web page

<script type="text/javascript"> 
  function showBoard() {
    game = Chessboard.newGame();
    game.move("e4, Nf6");
    game.draw("myboard");
  }
</script> 

And call this script on page load.

<body onload="showBoard();">

The result should look like that:

Powered by Google Project Hosting