Hello, what's the best way to make a grid by Javascript and HTML? I need to be able to draw or change the area color of each blank space. I made it that way but it does not answer because when I try to change the color of a single square it ends up changing either the entire line or the entire column.
for(var i = 0;i < linha;i++) {
for (var n = 0;n < coluna;n++) {
grid_x[i] = i * 40;
grid_y[n] = n * 40;
res_x[i] = i * 40;
res_y[n] = n * 40;
c[i] = false * i
dRs(grid_x[i],grid_y[n],grid_w,grid_h,1,"#747474",c[i])
}
}
function dRs(x,y,w,h,l,s,c) {
context.beginPath();
context.lineWidth= l;
context.strokeStyle= s;
context.rect(x,y,w,h);
context.stroke();
}