반응형
<head>
<title></title>
</script>
</head>
<body>
<div id="thetable"></div>
<script type = "text/javascript" >
var table = document.createElement("table");
table.border = "1";
var tbody = document.createElement("tbody");
table.appendChild(tbody);
var row = document.createElement("tr");
for (i = 1; i < 3; i++) {
var row = document.createElement("tr");
for (j = 1; j < 3; j++) {
var td = document.createElement("td");
var data = document.createTextNode("Row " + i + ", Column " + j);
td.appendChild(data);
row.appendChild(td);
}
tbody.appendChild(row);
}
document.getElementById("thetable").appendChild(table);
</script>
</body>
<title></title>
</script>
</head>
<body>
<div id="thetable"></div>
<script type = "text/javascript" >
var table = document.createElement("table");
table.border = "1";
var tbody = document.createElement("tbody");
table.appendChild(tbody);
var row = document.createElement("tr");
for (i = 1; i < 3; i++) {
var row = document.createElement("tr");
for (j = 1; j < 3; j++) {
var td = document.createElement("td");
var data = document.createTextNode("Row " + i + ", Column " + j);
td.appendChild(data);
row.appendChild(td);
}
tbody.appendChild(row);
}
document.getElementById("thetable").appendChild(table);
</script>
</body>