I have a .js file that creates a 4x4 table that way:
document.write('<div align="center"><table>');
for (var a = 0; a < 4; a++) {
document.write('<tr>');
for (var b = 0; b < 4; b++) {
document.write('<td align="center" id="t' +((4 * a) + b) + '"></td>');
}
document.write('<\/tr>');
}
What if I want to add one column and one row to that table after the page is loaded? In other terms, I'm looking for the same function but the "4" is a variable and I get its value from a checkbox.
(I didn't put that code in a proper function because every time I call document.write in a function, the page goes blank).
Maybe there is another way to use it in a function without document.write and that's what I'm looking for.
So I tried to concat all the '' strings and apply them to the .innerHTML of the table, but it didn't work. Any ideas why? And how can I correct the bug?
Thank you. (No jQuery answers please...)