<html>
<head>
<title>WePlayGo</title>
<link rel="stylesheet" href="css/custom.css" type="text/css" media="screen, projection">
</head>
<body>
<canvas id="canvas" class="canvas" width="400" height="180"></canvas>
<p id="debug"></p>
<script type="application/javascript">
...
var img = new Image();
img.src = 'bg_wood.jpg';
img.onload = function()
{
var boardBG = gridContext.createPattern(img, 'repeat');
gridContext.globalCompositeOperation = 'destination-over';
gridContext.fillStyle = boardBG;
gridContext.fillRect(xStart - gridPadding,
yStart - gridPadding,
gridSize + gridPadding * 2,
gridSize + gridPadding * 2);
gridContext.globalCompositeOperation = 'source-over';
}
....
</script>
</body>
</html>