简单教程
提交运行
代码编辑器:
<script> function show(){ document.getElementById("myTable").style.emptyCells="show"; } function hide(){ document.getElementById("myTable").style.emptyCells="hide"; } </script> <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()">显示空单元格</button> <button type="button" onclick="hide()">隐藏空单元格</button> <p><b>注意:</b> Internet Explorer 8 及更早版本要支持empty-cells属性必须声明 !DOCTYPE </p>
运行结果: