编辑下面的代码:【加编码】
<html> <head> <script> function show() { document.getElementById("myTable").style.emptyCells="show"; } function hide() { document.getElementById("myTable").style.emptyCells="hide"; } </script> </head> <body> <table id="myTable" border="1"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td></td> </tr> </table> <br> <button type="button" onclick="show()">Show empty cells</button> <button type="button" onclick="hide()">Hide empty cells</button> <p><b>Note:</b> Internet Explorer 8 supports the empty-cells property only if a !DOCTYPE is specified.</p> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂