HTML and CSS Reference
In-Depth Information
if (color === "black") {
img = images[];
else {
img = images[];
(75 - / 2 + (75 * column),
73 - + (75 * row),,;
This code uses the same transaction object, which is passed in. It obtains the pieceType object store and
then calls its get() method. The onsuccess event handler gets the necessary properties and calls the canvas
drawImage() method. Refer to Chapter 10 for more information about drawing images on a canvas.
Now add the call to drawAllPieces() in the onsuccess event handler for the open() call by adding the code
shown in bold:
request.onsuccess = function (event) {
db =;
// Add the pieces to the board
// Draw the pieces in their initial positions
Testing the Application
Now you're ready to test the application, which will display the initial starting positions. Make sure that the debug
browser is set as Firefox and press F5 to start the application. You should see an alert letting you know that the
database is being configured as shown in Figure 11-3 .
Figure 11-3. The alert showing the database is being configured
Search WWH ::

Custom Search