HTML
  Home arrow HTML arrow Page 5 - Using the HTML Table Element as a Recordse...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
HTML

Using the HTML Table Element as a Recordset
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 5
    2008-07-21

    Table of Contents:
  • Using the HTML Table Element as a Recordset
  • Minimum Requirements of a Read/Write Recordset
  • Our Illustrative Web Page
  • Editing Data
  • Add a Row

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using the HTML Table Element as a Recordset - Add a Row


    (Page 5 of 5 )

    You add (insert) a row using a row index. If you add (insert) a row with index 3, the row which had the index 3 will now have the index 4. When you add a row, it pushes the row which was at its position, and the rows below that one, one step downward. The following statement would add a row with the index value of i.

    document.getElementById('Recordset1').insertRow(i)


    Notice the method “insertRow(i)” at the end. When you add a row, the row is empty, that is, it does not have a cell. You then have to add (insert) cells in the row. The following statement will add (insert) a cell in the row whose index value is i, and at a position where the cell (column) index is j.


    document.getElementById('Recordset1').rows[i].insertCell(j)


    Notice the method “insertCell(j)at the end. To add more than one cell, you need a loop.


    Now, add the following button (code) to the body element in the above file content.


    <br /><br />

    <button type="button" onclick="addRow(5,6)">Add Row</button>


    The above button will call the following function. Include this code in the JavaScript above.


    function addRow(rowNo,noColms)

    {

    document.getElementById('Recordset1').insertRow(rowNo);


    for (j=0;j<noColms;j++)

    {

    document.getElementById('Recordset1').rows[rowNo].insertCell(j);

    }

    }


    This function takes, as arguments, the row index and the number of cells (noColms -- for number of columns). It produces the row and then the “for” loop produces the cells.


    Conclusion

    Any good container can be used as a recordset. The HTML table element can be used as a recordset in a web page. With the value of “none” for the CSS display property, you do not see the recordset. With the value of “block” for the CSS display property, you see the recordset. The DOM allows us to use the HTML table as a recordset.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · Did you know that HTML indirectly gives you a recordset? This article explains all...
       · Is this supposed to be valid HTML? It's neither XHTML (there aren't any quotes...
       · I intended to give just the important points. All what you have said can be added in...
     

    HTML ARTICLES

    - Comparing Browser Response to Active Client ...
    - Testing Browser Response to Active Client Pa...
    - Active Client Pages: Completing the Code for...
    - ACP and Browsers: Setting up an Example
    - How Browsers Respond to Active Client Pages
    - Completing a Tree with Active Client Pages
    - HTML Form Verification and ACP
    - Building an ACP Tree
    - Completing an ACP 3D HTML Table Image Gallery
    - Building an ACP 3D HTML Table Image Gallery
    - A Multiple Page Image Gallery with Active Cl...
    - Building an Image Gallery with Active Client...
    - Concluding a Menu for All Browsers
    - A Vertical Menu for All Browsers
    - Downloading Long HTML Pages with ACP







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek