HTML
  Home arrow HTML arrow Page 2 - Quick Web Page Menu
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

Quick Web Page Menu
By: Chrysanthus Forcha
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 7
    2008-04-30

    Table of Contents:
  • Quick Web Page Menu
  • Strategy
  • Code continued
  • Explanation of Code

  • 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


    Quick Web Page Menu - Strategy


    (Page 2 of 4 )


    Strategy

    Consider an HTML parent element such as the Table Cell. You can type the text of the main menu item as the first content of the table cell. Next, follow this text by typing a line break "<br />" . The line break will force the next element to appear below the text in the parent (TD) element. The next element that goes below the text should be a block level element (DIV for example) that can take in text, links, lists etc. This block level element will have the absolute position property.

    However, it should not be given any position, that is, it should not be given the Left and Top CSS properties. Give your BODY element a z-index of 0. Give the block level element with the absolute position property, a very high z-index such as 20 that you think no other element in the web page can have. You can then use JavaScript to make this block level element visible or hidden when the user clicks the first content (text in this case) in the parent (TD) element.

    Example

    In the following example we shall create a table of one row with three table cells. This row represents the menu bar, which is your main menu. In the first and last table cell we shall create a DIV element having links. These DIV elements will be given the absolute position property but no position (no Left and Top properties). They will each be given a z-index value of 20 which we think no other element in the web page can have.

    The first content in the first table cell will be the text "Pull Down First Menu." The first content of the third table cell will be the text "Pull Down Second Menu." This is the code that does the work. I explain it below:


    <html>


    <head>

    <style type="text/css">

    body {position:relative; z-index:0}

    table.menu {background-color:Fuchsia; border-width:0px}

    div {position:absolute;z-index:20;background-color:Fuchsia; visibility:hidden}

    </style>

    <script type="text/javascript">

    var menuClicked = false; //to indicate whether the menu was clicked

    var onlyBodyClicked = false; // to indicate that the menu bar was not clicked, but other part of body was clicked


    function showHideMenu(ID)

    {

    //a drop down menu might be visible (opened) at this point, so we close (hide) all the menus.

    document.getElementById("D1").style.visibility = "hidden";

    document.getElementById("D2").style.visibility = "hidden";

     

    //now make visible the one for the TD that was clicked

    document.getElementById(ID).style.visibility = "visible";

    More HTML Articles
    More By Chrysanthus Forcha


       · If you are looking for an approach to creating web page menus that is independent of...
     

    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
    Stay green...Green IT