<html>
<head>
<style>
table,th
{
border:1px solid black;
}
</style>
</head>
<body>
<p>点击按钮返回 id 为 "myTh" 的 th 的 headers 属性的值。</p>
<table id="myTable">
<tr>
<th id="name" colspan="3">Name</th>
</tr>
<tr>
<th id="myTh" headers="fname">First name</th>
<th headers="mname">Middle name</th>
<th headers="lname">Last name</th>
</tr>
</table>
<br>
<button onclick="myFunction()">尝试一下</button>
<p id="demo"></p>
<script>
function myFunction()
{
var x = document.getElementById("myTh").headers;
document.getElementById("demo").innerHTML=x;
}
</script>
</body>
</html>