Create a Caption : Caption « Table « JavaScript DHTML






Create a Caption

    
<html>
<body>
<script language="JavaScript">
function function1() {
    var myC = document.getElementById("myT").createCaption();
    myC.innerText = "This is the new caption text";
} 
</script>
<table id="myT" border="3" cellpadding="5" style="border-color:blue">
    <tr>
        <th>This table has no caption</th>
    </tr>
</table>
<input id="myT" type="button" value="Add caption" onclick="function1();">
</body>
</html>

    
      
      








Related examples in the same category

1.Table Caption align Example
2.Caption Vertical Align
3.Delete a Caption
4.Get caption from table object