table - HTML元素

来源:百度文库 编辑:神马文学网 时间:2024/05/04 01:55:24
定义
Specifies that the contained content is organized into a table with rows and columns.
说明所含内容组织成含有行和列的表格形式。
注释
下列标签可在表格结构中出现: CAPTION, COL, COLGROUP, TBODY, TD, TFOOT, TH, THEAD 和 TR。
对于每个 table 对象,仅可指定一个 tHead 和 tFoot。
在文档载入的过程中,对表格的修改将被限制,直到 onload 事件发生。任何时刻都允许只读访问。
表格对象模型对于数据绑定的表格是只读的。例如,用于删除表格行的脚本可以在未绑定的表格上正确运行,但无法在已绑定数据的表格上运行。table 对象的属性仍旧可用,但是对表格中的绑定数据进行的更改必须通过数据源。
表格的属性区分于表格中所包含的单元格的属性。例如,多列表格的 offsetLeft 属性与表格中最左端单元格的 offsetLeft 属性并不相同。请在编写脚本时选择正确的表格和/或单元格对象。
table 对象及其相关的元素有各自独立的表格对象模型,这与常规对象模型所采用的方法有很大不同。要获得关于表格对象模型更多的信息,请参看如何动态生成表格。
在脚本中访问 height 属性时,请使用 pixelHeight 或 posHeight 属性控制高度的数值。
如果想要对高度和宽度进行动态变更,那么原始值必须是通过样式指定的(例如,style="height:200px; width:200px"),而不是通过 height 和 width 标签属性。
表格的许多样式并不从 table 和其父对象中继承。这其中包括: font-size; font-weight; line-height; text-align; font-style; font-variant。
此元素在 Internet Explorer 3.0 及以上版本的 HTML 中可用,在 Internet Explorer 4.0 及以上版本的脚本中可用。
此元素是一个块元素。
此元素需要关闭标签。
The following tags are valid in table construction: CAPTION, COL, COLGROUP, TBODY, TD, TFOOT, TH, THEAD, and TR.
For each table object, only one tHead and tFoot can be specified.
While a document loads, modifications to a table are restricted until the onload event occurs. Read-only access is allowed at any time.
The table object model is read-only for databound tables. For example, script used to remove a table row works correctly on an unbound table, but not on a databound table. The properties of a table object are still available, but changes to the bound data in a table must be made to the data source.
The properties of a table are distinct from the properties of cells contained within the table. For example, the offsetLeft property of a multicolumn table is not the same as the offsetLeft property of the left-most cell in the table. Refer to the appropriate object when writing scripts involving table and/or cell objects.
The table object and its associated elements have a separate table object model, which utilizes different methods than the general object model. For more information on the table object model, see How to Build Tables Dynamically.
When scripting the height property, use either the pixelHeight or posHeight property to numerically manipulate the height value.
If dynamic changes are intended for the height and width, the original values should be set through style (for example, style="height:200px; width:200px") rather than through the height and width attributes.
Many styles do not inherit to a table and its contents from its parent object. Among these are: font-size; font-weight; line-height; text-align; font-style; font-variant.
This element is available in HTML as of Internet Explorer 3.0, and in script as of Internet Explorer 4.0.
This element is a block element.
This element requires a closing tag.
示例代码
Heading 1Heading 2
Row 1, Column 1 text.Row 1, Column 2 text.
Row 2, Column 1 text.Row 2, Column 2 text.