In the following script, 2 of the 3 canvas displays
appear correctly. Where is the 3rd going?
I’m not getting any errors, but the 3rd canvas does not appear. ?
[code]
<!DOCTYPE html>
<html>
<body>
<canvas id=”myCanvas0″ width=”100″ height=”170″ style=”border:1px solid #d3d3d3;”>
Your browser does not support the HTML5 canvas tag.</canvas>
<canvas id=”myCanvas1″ width=”100″ height=”170″ style=”border:1px solid #d3d3d3;”>
<canvas id=”myCanvas2″ width=”100″ height=”170″ style=”border:1px solid #d3d3d3;”>
<script>
function drawFretboard(sw,canvasID,txt) {
var c = document.getElementById(canvasID);
var ctx = c.getContext(“2d”);
for (var s=0; s<4; s++) {
ctx.moveTo(sw+(s*sw),10+sw); ctx.lineTo(sw+(s*sw),130+sw);
}
for (var l=0; l<7; l++) {
ctx.moveTo(sw,(l*sw)+10+sw); ctx.lineTo(sw+60,(l*sw)+10+sw);
}
ctx.font = ’15px san-serif’;
ctx.textBaseline = “top”;
ctx.fillText(txt, sw, sw-10);
ctx.stroke();
}
drawFretboard(20,’myCanvas0′,’G C E A’);
drawFretboard(20,’myCanvas1′,’XXX’);
drawFretboard(20,’myCanvas2′,’YYY’);
</script>
</body>
</html>