HTML
  Home arrow HTML arrow Choosing Sub Menus for a Common Browser Me...
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

Choosing Sub Menus for a Common Browser Menu
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating:  stars stars stars stars stars / 0
    2009-05-01

    Table of Contents:
  • Choosing Sub Menus for a Common Browser Menu
  • The removeSubMenu() Function
  • The Statements in the for-loops
  • Some Comments

  • 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


    Choosing Sub Menus for a Common Browser Menu


    (Page 1 of 4 )

    In this part of the series, we discuss how the sub menus, including drop-down menus, are removed from the screen. We shall also see how the series will progress. This is the ninth part of a ten-part series covering the creation of a common browser menu.

    The toChoose() Function

    There are four functions for the code. This is the shortest. We said that when the BODY element receives a click, any sub menu displayed (the drop down menu is also a sub menu) should go off the screen. So when you click the BODY element outside the table having the sub menus, any sub menu displayed goes off the screen as required.

    When you click any cell on our table, the BODY element indirectly receives a click. So any sub menu displayed should go off. What we want to have happen is that, when you click the cell of a sub menu item, the sub menu should not go off, but when you click the cell of a non-sub menu item, the sub menu should go off. There is a global variable, named subMenuJustClicked, that is used to make this difference. This global variable works with the toChoose() function. This global variable and the toChoose() function are:


    var subMenuJustClicked = false; //for removing sub menus


    function toChoose(ID)

    {

    if (document.getElementById(ID).style.backgroundColor == "firebrick")

    subMenuJustClicked = true;

    }


    There is the onclick attribute for every cell in our table. The onclick event calls this function. When a cell is clicked, this function is called with the ID of the cell sent as an argument. The aim of this function is to distinguish between clicking a cell that has a menu (sub) item, and clicking a cell that does not have a menu item.

    Before you click a cell, your mouse pointer has to first be over the cell. If the cell has a sub menu item, then the background color of the cell should be firebrick. When this function is called as a result of clicking a cell, the function checks to see if the background color of the cell is firebrick. If it is, it means that a sub menu item has been clicked, and the sub menu should not be removed from the screen, so the functions sets the subMenuJustClicked global variable to true to indicate this.

    The default and the initial value of subMenuJustClicked is false. The function to remove the sub menus verifies the value of this variable before it does anything. If the value is true, it does not remove the sub menus; if it is false, it removes the sub menus.

    More HTML Articles
    More By Chrysanthus Forcha


     

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