HTML DOM caption Property
Complete Table Object Reference
Definition and Usage
The caption property sets or returns the caption element of a table.
The <caption> element defines a table caption. The <caption> tag must be
inserted immediately after the <table> tag. You can specify only one caption per
table. Usually the caption will be centered above the table.
Syntax
tableObject.caption=captionObject
|
Example
The following example returns the text in the <caption> element of a table:
<html>
<head>
<script type="text/javascript">
function alertCaption()
{
alert(document.getElementById("table1").caption.innerHTML);
}
</script>
</head>
<body>
<table id="table1" border="1">
<caption>This is a table caption</caption>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
</tr>
</table>
<br />
<input type="button" onclick=alertCaption()
value="Alert table caption" />
</body>
</html>
|
Try-It-Yourself Demos
Get
the text in the <caption> element of a table
Complete Table Object Reference
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|