1. 程式人生 > >js中的 Table 對象

js中的 Table 對象

clas 單元 reat 及其 html rule 方向 ram padding

Table 對象
Table 對象代表一個 HTML 表格。
在 HTML 文檔中 <table> 標簽每出現一次,一個 Table 對象就會被創建。

Table 對象集合
cells[] 返回包含表格中所有單元格的一個數組。
rows[] 返回包含表格中所有行的一個數組。
tBodies[] 返回包含表格中所有 tbody 的一個數組。

Table 對象屬性
align 表在文檔中的水平對齊方式。(已廢棄)
bgColor 表的背景顏色。(已廢棄)
border 設置或返回表格邊框的寬度。
caption 對表格的 <caption> 元素的引用。
cellPadding 設置或返回單元格內容和單元格邊框之間的空白量。
cellSpacing 設置或返回在表格中的單元格之間的空白量。
frame 設置或返回表格的外部邊框。
id 設置或返回表格的 id。
rules 設置或返回表格的內部邊框(行線)。
summary 設置或返回對表格的描述(概述)。
tFoot 返回表格的 TFoot 對象。如果不存在該元素,則為 null。
tHead 返回表格的 THead 對象。如果不存在該元素,則為 null。
width 設置或返回表格的寬度。

標準屬性
className 設置或返回元素的 class 屬性。
dir 設置或返回文本的方向。
lang 設置或返回元素的語言代碼。
title 設置或返回元素的 title 屬性。

Table 對象方法
createCaption() 為表格創建一個 caption 元素。
createTFoot() 在表格中創建一個空的 tFoot 元素。
createTHead() 在表格中創建一個空的 tHead 元素。
deleteCaption() 從表格刪除 caption 元素以及其內容。
deleteRow() 從表格刪除一行。
deleteTFoot() 從表格刪除 tFoot 元素及其內容。
deleteTHead() 從表格刪除 tHead 元素及其內容。
insertRow() 在表格中插入一個新行。

js中的 Table 對象