<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> bzChess example - Playing puzzle </title>
<meta name="author" content="Gábor Martini" />
<meta name="keywords" content="chess fen pgn puzzle" />
<meta name="description" content="Javascript chess object to display positions" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<SCRIPT type="text/javascript" LANGUAGE=javascript src="bzchess.js"></script>
<LINK rel="stylesheet" type="text/css" media="screen" href="chess.css" />
<script type="text/javascript">
<!--
function bza_init_chesstable(el) {
el.chessgame = new bzChess(el);
el.chessgame.onPuzzleSolved = function () {
alert("Puzzle is solved");
}
el.chessgame.onWrongPuzzleStep = function () {
alert("Wrong puzzle step");
}
el.chessgame.onGoodPuzzleStep = function () {
alert("Good puzzle step");
}
el.chessgame.onAfterLoadPGN=function(lr){
comment.innerHTML = this.getfirst().ravtitle;
}
}
function loadPuzzle(puzzle) {
mybrd.chessgame.loadPuzzle(puzzle);
}
//-->
</script>
</head>
<body onload="bza_init_chesstable(mybrd)">
<h1>Example: Playing puzzle</h1>
<table width="100%">
<tr>
<td style="vertical-align: top;">
<div id="comment" style="border: 1px solid green; height:40px; width: 500px; margin-bottom: 10px; overflow: auto;"></div>
<div id="mybrd" class="chbrd" bzaobj="chesstable"></div>
</td>
<td style="vertical-align: top;"><br />
<div style="border: 1px solid green; width: 600px; margin-bottom: 10px;">
To set Puzzle click on one:
<ul style="font-family: monospace; font-size: smaller; cursor: pointer;">
<li>
<pre onclick="loadPuzzle(this.innerHTML)">
[Site "Leipzig"]
[Date "1888"]
[White "Mieses"]
[Black "Siegbert Tarrasch"]
[Result "1-0"]
[SetUp "1"]
[FEN "5kr1/2p3p1/pp2Rn1p/3P1QNp/q1P5/6PP/PP4B1/6K1 w - - 0 1"]
1. Rxf6+
1-0
</pre>
</li>
<li>
<pre onclick="loadPuzzle(this.innerHTML)">
[Site "England"]
[Date "1981"]
[White "Adams "]
[Black "Andrew Whiteley"]
[SetUp "1"]
[FEN "4b2k/ppp1q1r1/4prRp/2Pp3P/5N2/P3Q3/1PP3P1/2KR4 w - - 0 1"]
{Fehér lép és tisztet nyer} 1. Nxd5 exd5 2. Qxe7 Rxe7 3. Rxf6
1-0
</pre>
</li>
</ul>
</div>
</td>
</tr>
</table>
</body>
</html>
|