天天看点

Table summary 属性

Table 对象

定义和用法

summary 属性可设置或返回表格的概述。

语法

设置 summary 属性:

tableObject.summary="text"

返回 summary 属性:

tableObject.summary

提示:

summary 属性没有默认值。

描述
text 摘要文本

浏览器支持

Table summary 属性
Table summary 属性
Table summary 属性
Table summary 属性
Table summary 属性

所有主要浏览器都支持 summary 属性

实例

弹出表格的摘要:

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title>菜鸟教程(runoob.com)</title>

<script>

function displayResult(){

    alert(document.getElementById('myTable').summary);

}

</script>

</head>

<body>

<table id="myTable" border="1" summary="例如表中的员工">

    <tr>

        <th>Firstname</th>

        <th>Lastname</th>

    </tr>

        <td>Peter</td>

        <td>Griffin</td>

        <td>John</td>

        <td>Doe</td>

</table>

<br>

<button type="button" onclick="displayResult()">显示表格描述</button>

</body>

</html>

Table 对象