Table 的 rules规则

本文通过一个简单的HTML表格示例介绍了如何使用JavaScript来改变表格的边框样式,包括仅显示行边框、列边框、列组边框、所有边框以及不显示边框等不同效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> <script type="text/javascript"> function rowRules() { document.getElementById('myTable').rules = "rows" } function colRules() { document.getElementById('myTable').rules = "cols" } function groups() { document.getElementById('myTable').rules = "groups" } function all() { document.getElementById('myTable').rules = "all" } function none2() { document.getElementById('myTable').rules = "none" } </script> </head> <body> <table id="myTable" border="1"> <tr> <td> Row1 cell1 </td> <td> Row1 cell2 </td> </tr> <tr> <td> Row2 cell1 </td> <td> Row2 cell2 </td> </tr> <tr> <td> Row3 cell1 </td> <td> Row3 cell2 </td> </tr> </table> <br /> <input type="button" onclick="rowRules()" value="Show only row borders" /><br /> <input type="button" onclick="colRules()" value="Show only col borders" /><br /> <input type="button" onclick="groups()" value="Show only col groups" /><br /> <input type="button" onclick="all()" value="Show only col all" /><br /> <input type="button" onclick="none2()" value="Show only col none" /><br /> </body> </html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值