JavaScript 参考手册
Style captionSide 属性
把表格标题移到表格底部
源代码:
点击运行 »
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>蜜蜂教程(mifengjc.com)</title> <script> function displayResult() { document.getElementById("myCap").style.captionSide = "bottom"; } </script> </head> <body> <table border="1"> <caption id="myCap">My savings</caption> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$150</td> </tr> </table> <br> <button type="button" onclick="displayResult()">移动表格标题</button> </body> </html>
运行结果:
点击运行 »