HTML
  Home arrow HTML arrow Page 3 - Making a Common Browser Menu React
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

Making a Common Browser Menu React
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2009-04-03

    Table of Contents:
  • Making a Common Browser Menu React
  • Third Code Segment of the react() Function
  • Details of the react() Function
  • The Fourth Code Segment: Details

  • 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


    Making a Common Browser Menu React - Details of the react() Function


    (Page 3 of 4 )

    The react() function begins with an if-statement. As I said, the first six code segments out of the seven code segments are in this if-statement. This is the if-test:


    //react only if the background color of the table cell is brown

    if (document.getElementById(tdID).style.backgroundColor == "brown")

    {

    }


    The if-condition tests to see if the background color of the cell that called the react() function is brown; that is, if the cell has a SPAN element displayed. It uses the ID of tdID, which is the first parameter of the react() function for this.


    The First Code Segment: Details

    This is the code of the first code segment:


    //get the column no. We need it later.

    var colNo = tdID.charAt(3);

    colNo = parseInt(colNo);


    The ID of any table cell begins with "TD" followed by the table row number and the table column number. The first statement extracts the column number, which is at the last index position (3) of the ID string. It assigns the value to the colNo variable. The second line converts the character retrieved into an integer. We need this table column number later.

    The Second Code Segment: Details

    This segment sets all background colors on the column to brown. The column number retrieved above is used here. This is the segment:


    //set all background colors on the column to brown first

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

    {

    ID = "TD" + i + colNo

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

    }


    We have a for-loop here. The segment loops through the cells of the column. For each iteration, it forms the ID of the cell. The index of the iteration is considered to be the row number. The column number is already known from the previous segment. The colNo variable holds it.

    The Third Code Segment: Details

    When the mouse pointer is on a cell, the react() function is called. This segment is in the react() function. It gives the cell that called the function a background color of firebrick. This is the code segment.


    //give the onmouseover bar a firebrick color

    document.getElementById(tdID).style.backgroundColor = "firebrick";


    It uses the ID sent as the first argument of the react() function.


    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 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek