站内搜索
分类列表
本类阅读排行
本类推荐文章
- ASP技巧:让Len,Left,Right函数识...
- 用ASP实现IE地址栏参数的判断
- 如何实现ASP.NET网站个性化
- 如何在Asp.net中使用HtmlArea编辑...
- 用ASP.Net实现在线压缩和解压缩
- ASP实现不存在的网页就自动发送邮...
- 用ASP取出HTML里面的图片地址的函...
- asp.net跳转页面的三种方法比较
- 一个Winsock组件
- 用WinSock设计Chat程序(转)
- 在MFC应用中深入定制WebBrowser控...
- 这几天有人问关于编应.dll的问题,...
- 在Visual J++中编写ASP COM组件(转...
- 一个显示Grid的VBScript对象
- 好东西,快来看呀:(转载自中华网...
广告
How to Build Tables Dynamically(-)
作者: 来源: 点击: 日期:2007-4-9 23:38:25
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
<TABLE BORDER="1">
<TR>
<TD>Stock Symbol</TD>
<TD>High</TD>
<TD>Low</TD>
<TD>Close</TD>
</TR>
<TR>
<TD>ABCD</TD>
<TD>88.625</TD>
<TD>85.50</TD>
<TD>85.81</TD>
</TR>
<TR>
<TD>EFGH</TD>
<TD>102.75</TD>
<TD>97.50</TD>
--------------------------------------------------------------------------------
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
<TABLE BORDER="1">
<TR>
<TD>Stock Symbol</TD>
<TD>High</TD>
<TD>Low</TD>
<TD>Close</TD>
</TR>
<TR>
<TD>ABCD</TD>
<TD>88.625</TD>
<TD>85.50</TD>
<TD>85.81</TD>
</TR>
<TR>
<TD>EFGH</TD>
<TD>102.75</TD>
<TD>97.50</TD>
How to Build Tables Dynamically(-) 评论
