जावास्क्रिप्ट में टेबल को सही ढंग से लेआउट करने के लिए, tableLayout प्रॉपर्टी का उपयोग करें। लेआउट सेट करने के लिए प्रॉपर्टी को fixed पर सेट करें।
उदाहरण
जावास्क्रिप्ट के साथ टेबल सेल्स, रो, और कॉलम को लेआउट करने का तरीका सेट करना सीखने के लिए निम्न कोड चलाकर देखें:
<!DOCTYPE html> <html> <head> <style> table, td { border: 2px solid blue; } #myID { width: 100%; } </style> </head> <body> <button onclick = "display()">लेआउट प्रॉपर्टी सेट करें</button> <table id = "myID"> <tr> <td>यह डेमो के लिए टेक्स्ट है</td> <td>यह दूसरा टेक्स्ट है</td> </tr> <tr> <td>One</td> <td>1</td> </tr> <tr> <td>Two</td> <td>2</td> </tr> <tr> <td>Three</td> <td>3</td> </tr> </table> <script> function display() { document.getElementById("myID").style.tableLayout = "fixed"; } </script> </body> </html>