HTML
  Home arrow HTML arrow Page 4 - Opening Web Page Dialog Boxes with Other D...
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

Opening Web Page Dialog Boxes with Other Dialog Boxes
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 2
    2009-01-12

    Table of Contents:
  • Opening Web Page Dialog Boxes with Other Dialog Boxes
  • Content
  • Child HTML
  • Adding a Row in a Child Table

  • 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


    Opening Web Page Dialog Boxes with Other Dialog Boxes - Adding a Row in a Child Table


    (Page 4 of 4 )

    Here we shall see how you can add a row in a table in the child dialog box. The DOM syntax to add a row in a table in the current window (the web page that has the script) is:

    tableObject.insertRow(index)


    The “tableObject” in the syntax represents the table. This is normally replaced by the following statement:


    document.getElementById('myTableID')


    So to insert a row in a table in the current page you would type something like:


    document.getElementById('myTableID').insertRow(index)


    The index is the row number and its count begins from zero (not one).

    Now, to insert a row in the child dialog box, you precede the above with the child’s window reference and a dot -- that is:


    myWindow.document.getElementById('myTableID').insertRow(index)


    When you insert a row, the row is empty; you need to insert cells. When you insert a cell, it is empty; you need to insert its content. The DOM syntax to insert a cell is:


    tablerowObject.insertCell(index);


    The “tablerowObject” in the syntax represents the table row. This can be replaced by the following statement:


    document.getElementById('myTableID').rows[index]


    The index here is the row index. So to insert a cell in a table row of the current page you would type something like this:


    document.getElementById('myTableID').rows[index].insertCell(index);


    The index of the cell is the column number of the cell. Its count begins from zero (not one).

    To insert a cell in a table of the child dialog box, you precede the above with the child’s window reference and a dot -- that is:


    myWindow.document.getElementById('myTableID').rows[index].insertCell(index);


    After adding blank cells you may need to add the content. You use the innerHTML property. To add and automatically change the content of any cell you should type something like this:

    myWindow.document.getElementById('T1').rows[index].cells[index].innerHTML = "The Content";


    Assume that your child window has the following table:


    <table id="T1">

    <tr>

    <td>

    Cell 00

    </td>

    <td>

    Cell 01

    </td>

    <td>

    Cell 02

    </td>

    </tr>

    <tr>

    <td>

    Cell 10

    </td>

    <td>

    Cell 11

    </td>

    <td>

    Cell 12

    </td>

    </tr>

    </table>


    The following code adds an empty row and then uses a for-loop to add empty cells:


    myWindow.document.getElementById('T1').insertRow(1);

    for(i=0;i<3;i++)

    {

    myWindow.document.getElementById('T1').rows[1].insertCell(i);

    }


    In the above code, “myWindow” is the reference that was returned when the child window was opened.


    The following code will fill the new blank cells with content.


    myWindow.document.getElementById('T1').rows[1].cells[0].innerHTML = "New Cell 10";

    myWindow.document.getElementById('T1').rows[1].cells[1].innerHTML = "New Cell 11";

    myWindow.document.getElementById('T1').rows[1].cells[2].innerHTML = "New Cell 12";


    When you have a new row, you need to know the number of columns in the table in order to know the number of cells to add.

    We are through with the topic of changing and adding content to the immediate child box. Next we shall see how to do the same thing with the immediate parent.

    This is the end of this section. We take a break here. We shall continue in the next part of the series.


    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.

     

    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 2 Hosted by Hostway
    Stay green...Green IT