Create Table Head
<html> <body> <script language="JavaScript"> function function1() { var m = document.all.myT.createTFoot(); m.bgColor = 'red'; } function function2() { var n = document.all.myT.createTHead(); n.bgColor = 'yellow'; } </script> <table id="myT"> <thead id="th"> <tr> <th>Cell 1</th> <th>Cell 2</th> </tr> <tfoot id="tf"> <tr><td>Cell 3</td> <td>Cell 4</td> </tr> </table> <input type="button" value="Create tfoot" onclick="function1();"> <input type="button" value="Create thead" onclick="function2();"> </body> </html>