HTML
  Home arrow HTML arrow Page 3 - More on the React Function for a Common Br...
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

More on the React Function for a Common Browser Menu
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-04-10

    Table of Contents:
  • More on the React Function for a Common Browser Menu
  • The Fifth Code Segment Details
  • Code for the Fifth Code Segment
  • More on the Fifth Code Segment

  • 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


    More on the React Function for a Common Browser Menu - Code for the Fifth Code Segment


    (Page 3 of 4 )

    This is the code for the fifth segment:


    //if rooArr is empty and if subColNo is not empty

    if ((subColNo != "")&&(rootArr == ""))

    {

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

    {

    //form the TD ID

    tdIDSub = 'TD' + i + subColNo;

    //form ID of SPAN

    spanID = 'S' + tdID.charAt(2) + tdID.charAt(3) + i + subColNo;

    if (document.getElementById(spanID)) //if it exist

    {

    //first clear what was in the cell, if anything

    oldSpanID = 'S' + document.getElementById('TNo').rows[i].cells[subColNo].innerHTML;

    if (document.getElementById(oldSpanID))

    document.getElementById(oldSpanID).style.display = "none";


    document.getElementById(tdIDSub).style.backgroundColor = "brown";

    document.getElementById(spanID).style.display = "block";

    //indicate the cell that is displayed in the boolean table

    document.getElementById('TB').rows[i].cells[subColNo].innerHTML = "true";

    //indicate the first two numbers of the shown SPAN ID in the table that shows the Nos.

    number = "" + tdID.charAt(2) + tdID.charAt(3) + i + subColNo;

    document.getElementById('TNo').rows[i].cells[subColNo].innerHTML = number;

    }

    }

    }


    All of the statements are in an if-block. The condition in the if-statement tests if the second argument, subColNo of the react() function, is not empty and if the last argument, rooArr of the react() function, is empty. If these two tests are true, it means a sub menu is required directly from a cell in a drop down menu.

    The code then proceeds with the statements in the if-block. There is one main statement in the if-block, which is the for-loop. The for-loop iterates through five indices. We have five iterations here, because there are five cells in a column (for our example). In your own project, this number may change.

    The first statement in the for-loop creates the ID of the cell for the iteration (index). It uses the iteration number as the row number for the ID and it uses the second parameter, subColNo of the react() function, as the column number for the ID.

    The second statement in the for-loop develops the ID of the SPAN element. The number of digits in the number part of the SPAN element for the sub menu we are trying to develop is four. The first two digits of this SPAN element are the digits of the number part of the present cell. The ID of any cell begins with the letters "TD" and is followed by two numbers. The ID of any SPAN element for a sub menu developed from a drop down menu begins with "S" followed by four digits. The second statement forms the SPAN ID by first attributing the letter, "S," followed by the first digit from the cell ID, followed by the second digit from the cell ID, followed by the iteration number, followed by the column number of the cell in the sub menu.

    More HTML Articles
    More By Chrysanthus Forcha


     

    HTML ARTICLES

    - Hello HTML 5, Goodbye Gears
    - 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







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