คุณสมบัติ HTML DOM BlankCells ใช้เพื่อระบุวิธีแสดงเซลล์ว่างของตาราง โดยค่าเริ่มต้น คุณสมบัตินี้ถูกตั้งค่าให้แสดง
ต่อไปนี้เป็นไวยากรณ์สำหรับ −
การตั้งค่าคุณสมบัติ emptyCells -
empty-cells: show|hide|initial|inherit;
ที่นี่ "แสดง" จะแสดงเส้นขอบบนเซลล์ว่างในขณะที่ "ซ่อน" ไม่แสดง “ค่าเริ่มต้น” กำหนดให้เป็นค่าเริ่มต้น และ “สืบทอด” จะรับค่าคุณสมบัติหลัก
ให้เราดูตัวอย่างคุณสมบัติ emptyCells -
ตัวอย่าง
<!DOCTYPE html>
<html>
<head>
<style>
#TABLE1 {
font-style: italic;
empty-cells: hide;
}
table,td {
margin: 5px;
padding: 3px;
border: 1px solid black;
}
</style>
<script>
function showEmptyCells() {
document.getElementById("TABLE1").style.emptyCells="show"
document.getElementById("Sample").innerHTML="The empty cells of the table will now be visible";
}
</script>
</head>
<body>
<table id="TABLE1">
<tr>
<td>demo</td>
<td></td>
<td></td>
</tr>
<tr>
<td>demo</td>
<td></td>
<td></td>
</tr>
<tr>
<td>demo</td>
<td></td>
<td></td>
</tr>
</table>
<p>Show the hidden cells of the above table by clicking the below button</p>
<button onclick="showEmptyCells()">Show cells</button>
<p id="Sample"></p>
</body>
</html> ผลลัพธ์

เมื่อคลิกปุ่ม “แสดงเซลล์ ปุ่ม −
