x
 
<!DOCTYPE html>
<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() {
  document.getElementById("myTh").headers = "newValue";
  document.getElementById("demo").innerHTML = "headers 属性的值已从“name”更改为“newValue”。";
}
</script>
</body>
</html>