JavaScript Reference/Javascript Methods/createCaption — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:22, 26 мая 2010
"createCaption()" Example
<html>
<body>
<script language="JavaScript">
function function1() {
var myC = document.getElementById("myTable").createCaption();
myC.innerText = "This is the new caption text";
}
</script>
<table id="myTable" border="3" cellpadding="5" style="border-color:blue">
<tr>
<th>This table has no caption</th>
</tr>
</table>
<input type="button" value="Add caption" onclick="function1();">
</body>
</html>
"createCaption()" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |<table> |
+----------------+--------------------------------------------------------------+
"createCaption()" Syntax, Parameters and Note
Note:
Creates a <caption> element associated with the specified table.
The contents of the <caption> must also be set at run time.
Syntax:
document.getElementById("tableID").createCaption()
document.all.tableID.createCaption() // IE only