caption 属性设置或返回表格的 caption 元素。
<caption> 元素定义了一个表格标题。<caption> 标签必须紧跟在 <table> 标签之后,每个表格仅能规定一个 caption。通常,caption 会位于表格之上居中的位置。
</>code
- tableObject.caption=captionObject
下面的例子可返回表格的 <caption> 元素的文本:
</>code
- <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>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛
Powered by 365建站网 RSS地图 HTML地图
copyright © 2013-2024 版权所有 鄂ICP备17013400号