HTML DOM TableRow অবজেক্ট একটি HTML ডকুমেন্টের <tr> এলিমেন্টকে প্রতিনিধিত্ব করে।
TableRow অবজেক্ট তৈরি
সিনট্যাক্স
সিনট্যাক্স নিচে দেওয়া হলো:
document.createElement(“TR”);
TableRow অবজেক্টের প্রোপার্টিসমূহ
| প্রোপার্টি | ব্যাখ্যা |
|---|---|
| rowIndex | একটি টেবিলের rows কালেকশনে সারির অবস্থান রিটার্ন করে। |
| sectionRowIndex | thead, tbody, বা tfoot-এর rows কালেকশনে সারির অবস্থান রিটার্ন করে। |
TableRow অবজেক্টের মেথডসমূহ
| মেথড | ব্যাখ্যা |
|---|---|
| deleteCell() | বর্তমান টেবিল সারি থেকে একটি সেল সরিয়ে ফেলে। |
| insertCell() | বর্তমান টেবিল সারি একটি সেল যোগ করে। |
উদাহরণ
TableRow অবজেক্টের একটি উদাহরণ:
<!DOCTYPE html> <html> <style> body { color: #000; background: lightblue; height: 100vh; text-align: center; } table { margin: 2rem auto; width: 400px; } .btn { background: #db133a; border: none; height: 2rem; border-radius: 2px; width: 40%; display: block; color: #fff; outline: none; cursor: pointer; margin: 1rem auto; } </style> <body> <h1>DOM TableRow Object Demo</h1> <table border="2"> <thead> <tr> <th>Name</th> <th>Language</th> </tr> <thead> <tbody class="table-body"> <tr> <td>John</td> <td>English</td> </tr> <tr> <td>Elon</td> <td>Germany</td> </tr> </tbody> </table> <button onclick="get()" class="btn">Create TableRow</button> <script> function get() { var tr = document.createElement("TR"); tr.innerHTML = "<td>Mario</td><td>French</td>" document.querySelector(".table-body").appendChild(tr); } </script> </body> </html>
আউটপুট

"Create TableRow"-এ ক্লিক করুন একটি টেবিল সারি তৈরি করতে।
