1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | <html> <head> <title>99</title> <script> function buildTable(){ docBody = document.getElementsByTagName("body").item(0) myTable = document.createElement("TABLE") myTable.id ="TableOne" myTable.border = 1 myTableBody = document.createElement("TBODY") for (i = 0; i < 9; i++){ row = document.createElement("TR") for (j = 0; j < 9; j++){ cell = document.createElement("TD") cell.setAttribute("WIDTH","50") cell.setAttribute("HEIGHT","50") textVal = (i+1)*(j+1); textNode = document.createTextNode(textVal) cell.appendChild(textNode) row.appendChild(cell) } myTableBody.appendChild(row) } myTable.appendChild(myTableBody) docBody.appendChild(myTable) } window.onload = buildTable </script> </head> <body> </body> </html> |
Direct link: https://paste.plurk.com/show/1854416