JavaScript 参考手册
td/th rowSpan 属性
下面的例子更改了表元横跨的行数
源代码:
点击运行 »
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>蜜蜂教程(mifengjc.com)</title> <script> function displayResult() { document.getElementById("myHeader1").rowSpan = "2"; } </script> </head> <body> <table border="1"> <tr> <th id="myHeader1">Month</th> <th id="myHeader2">Savings</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> </body> </html>
运行结果:
点击运行 »