Create table caption
<html> <head> <script type="text/javascript"> function caption(){ var x=document.getElementById('myTable').createCaption() x.innerHTML="<b>My table caption</b>" } </script> </head> <body> <table id="myTable" border="1"> <tr> <td>d</td> <td>d</td> </tr> <tr> <td>d</td> <td>d</td> </tr> <tr> <td>Row3 cell1</td> <td>Row3 cell2</td> </tr> </table> <form> <input type="button" onclick="caption()" value="Create caption"> </form> </body> </html>