简单教程
提交运行
代码编辑器:
<script> function displayResult(){ document.getElementById("myHeader1").colSpan="2"; } </script> <table border="1"> <tr> <th id="myHeader1">月份</th> <th id="myHeader2">存款</th> </tr> <tr> <td>January</td> <td>$100.00</td> </tr> <tr> <td>February</td> <td>$10.00</td> </tr> <tr> <td>March</td> <td>$80.00</td> </tr> </table> <br> <button type="button" onclick="displayResult()">改变第一个单元格的横跨列数</button>
运行结果: