Hello...I want to draw 4 coins in a table that consists of 1 row and 2 columns. That means all the rows and all the columns must have all 4 coins. I have written the code as below. But it is giving the unexpected result. i.e., the coins are displaying in only 2 column ...plz give me some solution..
















var img,c,s;
var posX=0,posY=0;

var canvasA= document.getElementById("r1c1");
canvasA.addEventListener("onafterprint",placeA(),false);

var canvasB= document.getElementById("r1c2");
canvasB.addEventListener("onafterprint",placeB(),false);


function placeA()
{
c=document.getElementById("r1c1");
s = c.getContext("2d");
img = new Image();
img.onload= drawimage();
}

function placeB()
{
c=document.getElementById("r1c2");
s = c.getContext("2d");
img = new Image();
img.onload= drawimage();
}
function drawimage()
{
img.src="coin.jpg";
img.addEventListener("load",function(){s.drawImage(img,30,0,40,20)},false);
img.addEventListener("load",function(){s.drawImage(img,0,30,40,20)},false);
img.addEventListener("load",function(){s.drawImage(img,60,30,40,20)},false);
img.addEventListener("load",function(){s.drawImage(img,30,70,40,20)},false);
}