问题
I have this code already:
for (i=0;i<names.length;i++) {
var row = document.createElement('tr');
var col = document.createElement('td');
col.appendChild(document.createTextNode(names[i]));
row.appendChild(col);
document.getElementById('imagenametable').appendChild(row);
}
This is in Javascript. It does not seem to be adding anything to my table (which has an ID of imagenametable
. What is wrong? And yes, I do intend to just make rows of text in a table.
回答1:
You should inverse the two script tags : always load your libraries before any other scripts that uses them.
来源:https://stackoverflow.com/questions/12867533/add-new-rows-columns-to-a-table