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
2 Réponses
+ 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);
}
}
}
+ 1
Wow, thank you!