blob: 10738fc03b251eb114a7a6fc390de5423eb26712 [file] [log] [blame]
<html><head>
<title>table creation</title><style type="text/css">
caption { color: green; background-color: lightyellow; }
</style>
<script type="text/javascript">
function createTable (caption) {
var table = document.createElement('table');
table.border = 1;
document.body.appendChild(table);
if (caption) {
table.createCaption();
table.caption.appendChild(document.createTextNode(caption));
}
table.createTHead();
var row = table.tHead.insertRow(table.tHead.rows.length);
row.insertCell(0).appendChild(document.createTextNode('Header'));
table.appendChild(document.createElement('tbody'));
row = table.tBodies[0].insertRow(table.tBodies[0].rows.length);
row.insertCell(0).appendChild(document.createTextNode('Kibology'));
}
function createTable1 (caption) {
var table = document.createElement('table');
table.border = 1;
if (caption) {
table.createCaption();
table.caption.appendChild(document.createTextNode(caption));
}
table.createTHead();
var row = table.tHead.insertRow(table.tHead.rows.length);
row.insertCell(0).appendChild(document.createTextNode('Header'));
table.appendChild(document.createElement('tbody'));
row = table.tBodies[0].insertRow(table.tBodies[0].rows.length);
row.insertCell(0).appendChild(document.createTextNode('Kibology'));
document.body.appendChild(table);
}</script></head>
<body>
<script type="text/javascript">
createTable('Where is the table?');
document.body.appendChild(document.createElement('hr'));
createTable();
document.body.appendChild(document.createElement('hr'));
createTable1('Here is the table');
</script><table border="1"><thead><tr><td>Header</td></tr></thead><caption>Where is the table?</caption><tbody><tr><td>Kibology</td></tr></tbody></table><hr><table border="1"><thead><tr><td>Header</td></tr></thead><tbody><tr><td>Kibology</td></tr></tbody></table><hr><table border="1"><thead><tr><td>Header</td></tr></thead><caption>Here is the table</caption><tbody><tr><td>Kibology</td></tr></tbody></table>
</body></html>