DOM Table 对象

本文介绍了HTML表格(Table)对象的基本概念及使用方法,包括Table对象的属性、方法和事件等内容,适用于网页开发人员学习如何更好地控制和操作网页中的表格。

Table 对象

The Table object represents an HTML table. For each instance of an HTML <table> tag in a document, a Table object is created.
Tbale对象代表了HTML表格。每当HTML文档中出现<table>标签,就有一个Table对象建立起来了

IE: Internet Explorer, F: Firefox, N: Netscape, W3C: World Wide Web Consortium (Internet Standard).

Table 对象集合

Collection
集合
Description
描述
IE FNW3C
cells[]Returns an array containing each cell in the table
返回包含表格单元格的数组
5  No
rows[]Returns an array containing each row in the table
返回包含表格每行的数组
416Yes
tBodies[]Returns an array containing each tbody the table
返回每个表格tbody的数组
4  Yes

Table 对象属性

Property
属性
Description
描述
IE FNW3C
accessKeySets or returns the keyboard key to access the table
设置或返回表格的快速访问键
4  No
alignSets or returns the alignment of the table according to the surrounding text
设置或获取表格排列。
416Yes
backgroundSets or returns the background image of the table
设置或获取对象中文本和图像后平铺的背景图片。
4  No
bgColorSets or returns the background color of the table
不推荐。设置或获取对象后面的背景颜色。
416Yes
borderSets or returns the width of the table border
设置或获取绘制对象周围边框的宽度。
416Yes
borderColorSets or returns the color of the table border
设置或获取对象的边框颜色。
5  No
captionSets or returns the caption of the table
获取表格的 caption 对象。
416Yes
cellPaddingSets or returns the amount of space between the cell border and cell content
设置或获取介于单元格边框和单元格内容之间的空间总量。
416Yes
cellSpacingSets or returns the amount of space between cells in the table
设置或获取表格中单元格之间的空间总量。
416Yes
colsSets or returns the number of columns in the table
设置或获取表格的列数。
4  No
disabledSets or returns whether or not the table should be disabled
获取表明用户是否可与该对象交互的值。
5  No
frameSets or returns which borders to render around the table
设置或获取表格周围的边框显示的方式。
416Yes
heightSets or returns the height of the table
设置或获取对象的高度。
416Yes
idSets or returns the id of the table (In IE 4 this property is read-only)
获取标识对象的字符串。
41 No
rulesSets or returns which inner-borders to display in a table
设置或获取要显示哪些分隔线(内部边框)。
416Yes
summarySets or returns a description of the table
设置或获取对象的描述和/或结构。
616Yes
tabIndexSets or returns the tab order for the table
设置或获取定义对象的 Tab 顺序的索引。
4  No
tFootReturns the TFoot object of the table
获取表格的 tFoot 对象。
416Yes
tHeadReturns the THead object of the table
获取表格的 tHead 对象。
416Yes
widthSets or returns the width of the table
设置或获取对象的宽度。
416Yes

Table 对象方法

Method
方法
Description
描述
IEFNW3C
blur()Removes focus from the table
在对象失去输入焦点时触发。
4  No
click()Simulates a mouse-click on the table
在用户用鼠标左键单击对象时触发。
4  No
createCaption()Creates an empty caption element in the table
在表格中建立一个不带内容的标题元素
416Yes
createTFoot()Creates an empty tFoot element in the table
在表格中建立一个不带内容的tFoot元素
416Yes
createTHead()Creates an empty tHead element in the table
在表格中建立一个不带内容的tHead元素
416Yes
deleteCaption()Deletes the caption element and its content from the table
从表格中删除元素标题以及它的内容
416Yes
deleteRow()Deletes a specified row from the table
从表格中删除指定的行
416Yes
deleteTFoot()Deletes the tFoot element and its content from the table
从表格中删除tFoot元素以及它的内容
416Yes
deleteTHead()Deletes the tHead element and its content from the table
从表格删除tHead元素以及它的内容
416Yes
focus()Sets focus on the table
表格获取焦点
4  No
insertRow()Inserts a new row in the table
在表格中插入新的行
416Yes
moveRow(from,to)Moves a row to a new position
将一行移动到新的位置上
5  No
refresh()Refreshes the content of the table
刷新表格中的内容
4  No

Table 对象事件

Syntax: object.event_name="someJavaScriptCode"
语法:对象.事件名称="一些JS代码"

Event
事件
Description
描述
IEFNW3C
onBlurExecutes some code when the table loses focus
当表格失去焦点的时候执行一些代码
4   
onClickExecutes some code when the user clicks on the table
当用户点击表格的时候执行一些代码
4   
onFocusExecutes some code when the table gets focus
当表格得到焦点的时候执行一些代码
4   
onSelectStartExecutes some code when the table is selected
当表格被选中的时候执行一些代码
4   
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值