Đối tượng TableRow HTML DOM
Đối tượng TableRow
Đối tượng TableRow đại diện cho một phần tử HTML <tr>.
Truy cập một đối tượng TableRow
Bạn có thể truy cập phần tử <tr> bằng cách sử dụng getElementById ():
Thí dụ
var x = document.getElementById("myTr");
Mẹo: Bạn cũng có thể truy cập phần tử <tr> bằng cách tìm kiếm qua bộ sưu tập hàng của bảng.
Tạo một đối tượng TableRow
Bạn có thể tạo một phần tử <tr> bằng cách sử dụng phương thức document.createElement ():
Thí dụ
var x = document.createElement("TR");
Bộ sưu tập đối tượng TableRow
Collection | Description |
---|---|
cells | Returns a collection of all <td> or <th> elements in a table row |
Thuộc tính đối tượng 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 |
Phương thức đối tượng TableRow
Method | Description |
---|---|
deleteCell() | Deletes a cell from the current table row |
insertCell() | Inserts a cell into the current table row |
Thuộc tính và sự kiện tiêu chuẩn
Đối tượng TableRow cũng hỗ trợ các thuộc tính và sự kiện tiêu chuẩn .
Các trang liên quan
Hướng dẫn HTML: Bảng HTML
Tham chiếu HTML: Thẻ <tr> HTML