วัตถุHTML DOM TableRow
วัตถุ TableRow
วัตถุ TableRow แสดงถึงองค์ประกอบ HTML <tr>
เข้าถึงวัตถุ TableRow
คุณสามารถเข้าถึง <tr> องค์ประกอบโดยใช้ getElementById():
ตัวอย่าง
var x = document.getElementById("myTr");
เคล็ดลับ:คุณยังสามารถเข้าถึง <tr> องค์ประกอบโดยการค้นหาผ่าน คอลเลกชัน แถวของตาราง
สร้างวัตถุ TableRow
คุณสามารถสร้าง <tr> องค์ประกอบโดยใช้ document.createElement() วิธีการ:
ตัวอย่าง
var x = document.createElement("TR");
คอลเลกชันวัตถุ TableRow
Collection | Description |
---|---|
cells | Returns a collection of all <td> or <th> elements in a table row |
คุณสมบัติวัตถุ TableRow
Property | Description |
---|---|
align | Not supported in HTML5. Use style.textAlign instead. Sets or returns the horizontal alignment of the content within a table row |
bgColor | Not supported in HTML5. Use
style.backgroundColor instead. Sets or returns the background color of a table row |
ch | Not supported in HTML5. Sets or returns an alignment character for cells in a table row |
chOff | Not supported in HTML5. Sets or returns the horizontal offset of the ch property |
height | Not supported in HTML5. Use style.height instead. Sets or returns the height of a table row. |
rowIndex | Returns the position of a row in the rows collection of a table |
sectionRowIndex | Returns the position of a row in the rows collection of a tbody, thead, or tfoot |
vAlign | Not supported in HTML5. Use
style.verticalAlign instead. Sets or returns the vertical alignment of the content within a table row |
เมธอดอ็อบเจ็กต์ TableRow
Method | Description |
---|---|
deleteCell() | Deletes a cell from the current table row |
insertCell() | Inserts a cell into the current table row |
คุณสมบัติและเหตุการณ์มาตรฐาน
ออบเจ็กต์ TableRow ยังสนับสนุนคุณสมบัติและเหตุการณ์ มาตรฐาน อีกด้วย
หน้าที่เกี่ยวข้อง
กวดวิชา HTML: ตาราง HTML
อ้างอิง HTML: แท็ก HTML <tr>