运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <style> table, td { border: 1px solid black; margin: 15px; } </style> </head> <body> <h1>Change empty-cells with JavaScript</h1> <p>Click the "Try it" button to "hide" or "show" empty table-cells:</p> <button type="button" onclick="hide()">Hide empty cells</button> <button type="button" onclick="show()">Show empty cells</button> <table id="myTABLE"> <tr> <td>Peter</td> <td>Griffin</td> </tr> <tr> <td>Lois</td> <td></td> </tr> </table> <script> function hide() { document.getElementById("myTABLE").style.emptyCells = "hide"; } function show() { document.getElementById("myTABLE").style.emptyCells = "show"; } </script> </body> </html>