I have created an HTML5 canvas and using the stroke() method, ended up with a grid. Below is the code that i have used:
I now do see a grid display. However, i am trying to figure out how to add numeric data to each of the grid columns? Or Alternatively, is there a better way to accomplish this (i.e. to create a 2 dimensional grid and then be able to write numeric values to any specific square) besides using the canvas tag of HTML5?
<script>
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.fillStyle="#FFFFFF";
ctx.fillRect(0,0,600,400);
var hCount, vCount;
for (hCount=20; hCount<400; hCount+=20) {
ctx.moveTo(0,hCount);
ctx.lineTo(600,hCount);
ctx.stroke();
}
for (vCount=20; vCount<600; vCount+=20) {
ctx.moveTo(vCount,0);
ctx.lineTo(vCount,400);
ctx.stroke();
}
</script>