Table caption 属性

定义和用法

caption 属性返回表格的 <caption> 元素。

<caption> 元素定义表格的标题。

注意:<caption> 标签必须紧跟在 <table> 标签之后。您只能为每个表格规定一个标题。默认情况下,标题将在表格上方居中。

另请参阅:

HTML 参考手册:HTML <caption>-Tag

实例

提示标题元素内的文本:

alert(document.getElementById("myTable").caption.innerHTML);

Probieren Sie es selbst aus

Syntax

tableObject.caption

Technische Details

Rückgabewert: Der <caption>-Element der Tabelle, wenn nicht definiert, ist null.

Browser-Unterstützung

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Unterstützung Unterstützung Unterstützung Unterstützung Unterstützung