| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN style http://www.w3.org/TR/html4/strict.dtd"> |
| <html> |
| <head> |
| <script> |
| window.onload = createTable; |
| |
| function createTable() |
| { |
| var oTable = document.createElement("table"); |
| document.body.appendChild(oTable); |
| oTable.appendChild(document.createElement("tbody")); |
| |
| // THead creation block |
| var oTHead = oTable.createTHead(); |
| var oRow = oTHead.insertRow(0); |
| for( var col=0;col<8;col++) |
| { |
| var oCell = oRow.insertCell(col); |
| var cellValue = document.createTextNode("h" + col); |
| oCell.appendChild(cellValue); |
| } |
| |
| |
| // TFoot creation block |
| var oTFoot = oTable.createTFoot(); |
| oRow = oTFoot.insertRow(0); // create table footer row |
| for(col=0;col<8;col++) |
| { |
| oCell = oRow.insertCell(col); |
| cellValue = document.createTextNode("f" + col); |
| oCell.appendChild(cellValue); |
| } |
| |
| for(var row=0;row<1;row++) // ask for just 1 row |
| { |
| oRow = oTable.tBodies[0].insertRow(row); |
| for(col=0;col<8;col++) |
| { |
| oCell = oRow.insertCell(col); |
| var newValue2 = document.createTextNode("r" + row + "c" |
| + col); |
| oCell.appendChild(newValue2); |
| } |
| } |
| |
| oTable.border = 4; |
| |
| var str = ""; |
| str += ".rows.length: " + oTable.rows.length + "\n"; |
| //str += ".tHead.rows.length: " + oTable.tHead.rows.length + "\n"; |
| //str += ".tFoot.rows.length: " + oTable.tFoot.rows.length + "\n"; |
| str += ".tBodies.length: " + oTable.tBodies.length + "\n"; |
| str += ".tBodies[0].rows.length: " + oTable.tBodies[0].rows.length |
| + "\n"; |
| |
| //alert(str); |
| } |
| </script> |
| </head> |
| <body> |
| </body> |
| </html> |