3 <title>table creation
</title><style type=
"text/css">
4 caption
{ color: green
; background-color: lightyellow
; }
6 <script type=
"text/javascript">
7 function createTable (caption
) {
8 var table
= document
.createElement('table');
10 document
.body
.appendChild(table
);
12 table
.createCaption();
13 table
.caption
.appendChild(document
.createTextNode(caption
));
16 var row
= table
.tHead
.insertRow(table
.tHead
.rows
.length
);
17 row
.insertCell(0).appendChild(document
.createTextNode('Header'));
19 table
.appendChild(document
.createElement('tbody'));
20 row
= table
.tBodies
[0].insertRow(table
.tBodies
[0].rows
.length
);
21 row
.insertCell(0).appendChild(document
.createTextNode('Kibology'));
23 function createTable1 (caption
) {
24 var table
= document
.createElement('table');
27 table
.createCaption();
28 table
.caption
.appendChild(document
.createTextNode(caption
));
31 var row
= table
.tHead
.insertRow(table
.tHead
.rows
.length
);
32 row
.insertCell(0).appendChild(document
.createTextNode('Header'));
34 table
.appendChild(document
.createElement('tbody'));
35 row
= table
.tBodies
[0].insertRow(table
.tBodies
[0].rows
.length
);
36 row
.insertCell(0).appendChild(document
.createTextNode('Kibology'));
37 document
.body
.appendChild(table
);
41 <script type=
"text/javascript">
42 createTable('Where is the table?');
43 document
.body
.appendChild(document
.createElement('hr'));
45 document
.body
.appendChild(document
.createElement('hr'));
46 createTable1('Here is the table');
47 </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>