यह सेट करने के लिए कि टेबल बॉर्डर कॉलैप्स होना चाहिए या नहीं, borderCollapse प्रॉपर्टी का उपयोग करें और इसे collapse पर सेट करें। टेबल बॉर्डर को कॉलैप्स करने के लिए निम्न कोड चलाकर देखें:
उदाहरण
<!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()">कॉलैप्स करने के लिए क्लिक करें</button> <script> function display() { document.getElementById("newTable").style.borderCollapse = "collapse"; } </script> </body> </html>