Home arrow HTML arrow Page 2 - Using the HTML Table Element as a Recordset
HTML

Using the HTML Table Element as a Recordset


When you query a database, the result you receive is a recordset. The form in which your result can be presented is affected by the capabilities of the language you use. This can present a challenge for certain languages. This article presents one way to meet that challenge if you program for the web.

Author Info:
By: Chrysanthus Forcha
Rating: 4 stars4 stars4 stars4 stars4 stars / 7
July 21, 2008
TABLE OF CONTENTS:
  1. · Using the HTML Table Element as a Recordset
  2. · Minimum Requirements of a Read/Write Recordset
  3. · Our Illustrative Web Page
  4. · Editing Data
  5. · Add a Row

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Using the HTML Table Element as a Recordset - Minimum Requirements of a Read/Write Recordset
(Page 2 of 5 )

A recordset should have at least the following functions:

  • A function to give the total number of rows of the recordset.

  • A function to locate a row or cell in order to access data.

  • A function to edit data in a row.

  • A function to delete a row.

  • A function to add a row.

The HTML TABLE as a Container

The DOM gives the HTML table properties and methods to access the cell data, rows and columns. It is because of the DOM that we can use the HTML TABLE as a container. Features of the HTML DOM Table Object we shall use are as follows:

Table Object Collections

cells[]: Returns an array containing each cell in a table.

rows[]: Returns an array containing each row in a table.

Table Object Methods

insertRow(): Inserts a new row in a table.

deleteRow(): Deletes a row from a table.


Features of the HTML DOM TableRow Object we shall use are as follows:

TableRow Object Collections

cells[]: Returns an array containing each cell in the table row.

TableRow Object Methods

insertCell(): Inserts a cell in a table row.

TableCell Object Properties

InnerHTML: Sets or returns the HTML (cell content) between the start and end tags of a table cell.

We shall use the following data (employee table of a company) in our illustrations:


ID

NAME

DEPARTMENT

JOB

YEARS

SALARY

10

Smith

20

Mgr

8

18357.50

20

Jones

20

Sales

9

18171.25

30

Gates

38

Mgr

4

17506.75

40

Bond

38

Sales

6

18006.00

50

Murphy

15

Mgr

10

20659.80


blog comments powered by Disqus
HTML ARTICLES

- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5
- BBC Adopts HTML 5, Mozilla Addresses Issues
- Advanced Sticky Footers in HTML and CSS
- HTML and CSS Sticky Footers
- Strategy Analytics Predicts HTML5 Phones to ...
- HTML5 Guidelines for Web Developers
- Learning HTML5 Game Programming
- More Engaging CSS3 and HTML Background Effec...
- Engaging HTML and CSS3 Background Effects
- More Web Columns with CSS3 and HTML
- Columns with CSS3 and HTML
- Creating Inline-Block HTML Elements with CSS
- Drag and Drop in HTML5: Parsing Local Files

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 4 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials