设置是否使用JavaScript将表格边框折叠为单个边框?
若要设置是否折叠表格边框,请使用 borderCollapse属性并将其设置为折叠。您可以尝试运行以下代码来将表格边框设置为折叠-
示例
<!DOCTYPE html>
<html>
<body>
<table id="newTable" border="2">
<tr>
<th>EmpID</th>
<th>EmpName</th>
<th>EmpDept</th>
</tr>
<tr>
<td>001</td>
<td>Amit</td>
<td>IT</td>
</tr>
<tr>
<td>002</td>
<td>John</td>
<td>Finance</td>
</tr>
<tr>
<td>003</td>
<td>David</td>
<td>Marketing</td>
</tr>
</table>
<br>
<button onclick="display()">Click to collapse</button>
<script>
function display() {
document.getElementById("newTable").style.borderCollapse = "collapse";
}
</script>
</body>
</html>热门推荐
10 妈妈给宝贝祝福语简短
11 职场祝福语大全 简短精辟
12 整形机构开业祝福语简短
13 给爸爸发财祝福语简短
14 写给男生简短的祝福语
15 送情侣生日祝福语简短
16 送个姐妹生日祝福语简短
17 长辈钻石婚祝福语简短
18 祝福语大全简短赞美同学