0

Why my table not work?

I trying do make a multiplication table, but its not work well... https://code.sololearn.com/Wv86jmvvveh8/?ref=app

2nd Aug 2019, 1:25 PM
arieh
2 ответов
+ 7
I edited your JS slightly. window.onload = function() { for (i=1;i<=10;i++){ var table = document.getElementById("table"); var row = document.createElement("tr"); var celltype; for (j=1;j<=10;j++){ if (i == 1 || j == 1){ celltype = "th"; } else { celltype = "td"; } var cell = document.createElement(celltype); var txt = document.createTextNode(j*i); cell.appendChild (txt); row.appendChild (cell); table.appendChild(row); } } }
2nd Aug 2019, 3:37 PM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Wow, thank you!
3rd Aug 2019, 7:06 PM
arieh