PrimeNumberTable
by keithphw
HTML
<html>
<head>
<link rel = "stylesheet" href = "test.css">
<!--https://stackoverflow.com/questions/14643617/create-table-using-javascript-->
<body>
</body>
<script src = "test.js"></script>
</head>
</html>
JavaScript
var tableString = "<table>",
body = document.getElementsByTagName('body')[0],
div = document.createElement('div');
number = 1;
for (row = 1; row <= 10; row += 1) {
tableString += "<tr>";
for (col = 1; col <= 10; col += 1) {
tableString += "<td style='text-align: center; padding-left: 12px; padding-right: 12px;'>";
tableString += number+"<br/>2*3";
tableString +="</td>";
number++;
//tableString += "<td>" + "row [" + row + "]" + "col [" + col + "]" + "</td>";
}
tableString += "</tr>";
}
tableString += "</table>";
div.innerHTML = tableString;
body.appendChild(div);