Size:
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |
---|---|---|---|---|---|---|---|---|
1 | 1,1C1 | 1,2C2 | 1,3C3 | 1,4C4 | 1,5C5 | 1,6C6 | 1,7C7 | 1,8C8 |
2 | 2,1C9 | 2,2C10 | 2,3C11 | 2,4C12 | 2,5C13 | 2,6C14 | 2,7C15 | 2,8C16 |
3 | 3,1C17 | 3,2C18 | 3,3C19 | 3,4C20 | 3,5C21 | 3,6C22 | 3,7C23 | 3,8C24 |
4 | 4,1C25 | 4,2C26 | 4,3C27 | 4,4C28 | 4,5C29 | 4,6C30 | 4,7C31 | 4,8C32 |
5 | 5,1C33 | 5,2C34 | 5,3C35 | 5,4C36 | 5,5C37 | 5,6C38 | 5,7C39 | 5,8C40 |
6 | 6,1C41 | 6,2C42 | 6,3C43 | 6,4C44 | 6,5C45 | 6,6C46 | 6,7C47 | 6,8C48 |
7 | 7,1C49 | 7,2C50 | 7,3C51 | 7,4C52 | 7,5C53 | 7,6C54 | 7,7C55 | 7,8C56 |
2350 chars
function makeRows(m, n) {
let row = "<th></th>";
for (let j = 1; j <= n; j++)
row += "<th>"+j+"</th>";
let text = "<tr>"+row+"</tr>";
for (let i = 1; i <= m; i++) {
row = "<th>"+i+"</th>";
for (let j = 1; j <= n; j++) {
let p = n*(i-1)+j;
let s = "<span class=tip>C"+p+"</span>"
row += "<td>"+i+","+j+s+"</td>";
}
text += "<tr>"+row+"</tr>";
}
let t = text.length+" chars";
console.log("makeRows: "+m+"x"+n+" "+t);
tablo.innerHTML = text; out.innerText = t;
}