编辑下面的代码:【加编码】
<html> <head> <script> function displayResult() { document.getElementById("myTable").style.tableLayout="fixed"; } </script> </head> <body> <table id="myTable" width="300" border="1"> <thead> <th>Table header</th> <th>Table header</th> </thead> <tbody> <tr> <td>This is some text. This is some text.</td> <td>This is another text.</td> </tr> </tbody> </table> <br> <button type="button" onclick="displayResult()">Set fixed table layout</button> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂