686 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;
}