JavaScript Reference/Javascript Methods/createCaption

Материал из Web эксперт
Перейти к: навигация, поиск

"createCaption()" Example

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

"createCaption()" is applied to

| Applied_To     |<table>                                                       |

"createCaption()" Syntax, Parameters and Note

Creates a <caption> element associated with the specified table. 
The contents of the <caption> must also be set at run time.
document.all.tableID.createCaption() // IE only