1 | 2 | 3 | 4 | 5 | |
---|---|---|---|---|---|
1 | 1,1C1 | 1,2C2 | 1,3C3 | 1,4C4 | 1,5C5 |
2 | 2,1C6 | 2,2C7 | 2,3C8 | 2,4C9 | 2,5C10 |
3 | 3,1C11 | 3,2C12 | 3,3C13 | 3,4C14 | 3,5C15 |
686 chars
function makeRows(rowCount, colCount) {
let row = "<th></th>";
for (let j = 1; j <= colCount; j++)
row += "<th>"+j+"</th>";
let text = "<tr>"+row+"</tr>";
for (let i = 1; i <= rowCount; i++) {
row = "<th>"+i+"</th>";
for (let j = 1; j <= colCount; j++) {
let p = colCount*(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: "+rowCount+"x"+colCount+" "+t);
tablo.innerHTML = text; out.innerText = t;
}