最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
How to Build Tables Dynamically(-)
时间:2022-06-30 09:42:49 编辑:袖梨 来源:一聚教程网
How to Build Tables Dynamically
--------------------------------------------------------------------------------
This article discusses the structure of HTML tables and explains how to use the Table Object Model to create them. It also compares how the Table Object Model and the Document Object Model (DOM) are used to create tables.
The Table Object Model, introduced in Microsoft® Internet Explorer 4.0, enables you to have dynamic control over the content of tables―for example, you can add rows and cells, change the contents of cells, and resize table elements. Dynamic control is useful in situations such as building a table based on the contents of a database, or building a table of calculated data, such as a calendar.
Note When using Dynamic HTML (DHTML) to create a document, you can create objects and set the innerText or innerHTML property of the object. However, because of the specific structure required by tables, the innerText and innerHTML properties of the table and tr objects are read-only.
This article assumes you know how to write Microsoft® JScript® (compatible with ECMA 262 language specification).
Table Structure
Creating and Manipulating Tables
Table Object Model vs. the DOM
Sample Game Using the Table Object Model and the DOM
Table Structure
As a reminder, here is a discussion about the structure of tables. Tables consist of rows and columns, arranged in a manner similar to a spreadsheet. The following steps and sample code show how to use HTML to create a table.
Create opening and closing table tags.
Place tr tags within the table tags; the tr tags denote rows.
Place td tags within the tr tags; the td tags denote cells within rows.
Show Example
--------------------------------------------------------------------------------
This article discusses the structure of HTML tables and explains how to use the Table Object Model to create them. It also compares how the Table Object Model and the Document Object Model (DOM) are used to create tables.
The Table Object Model, introduced in Microsoft® Internet Explorer 4.0, enables you to have dynamic control over the content of tables―for example, you can add rows and cells, change the contents of cells, and resize table elements. Dynamic control is useful in situations such as building a table based on the contents of a database, or building a table of calculated data, such as a calendar.
Note When using Dynamic HTML (DHTML) to create a document, you can create objects and set the innerText or innerHTML property of the object. However, because of the specific structure required by tables, the innerText and innerHTML properties of the table and tr objects are read-only.
This article assumes you know how to write Microsoft® JScript® (compatible with ECMA 262 language specification).
Table Structure
Creating and Manipulating Tables
Table Object Model vs. the DOM
Sample Game Using the Table Object Model and the DOM
Table Structure
As a reminder, here is a discussion about the structure of tables. Tables consist of rows and columns, arranged in a manner similar to a spreadsheet. The following steps and sample code show how to use HTML to create a table.
Create opening and closing table tags.
Place tr tags within the table tags; the tr tags denote rows.
Place td tags within the tr tags; the td tags denote cells within rows.
Show Example
Stock Symbol | High | Low |