Home arrow HTML arrow Page 2 - Concluding a Menu for All Browsers
HTML

Concluding a Menu for All Browsers


At last we have a web page menu code that can be used for any browser without any of its code segments being specific to any particular browser. I called the design approach of the previous series the Simple Layout Approach. I call the design approach in this series the Elaborated Layout Approach. In this last part of the series I give you a summary of the two design approaches. I also give you the advantages and disadvantages of the two approaches. Everything in these two series is my conception.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
July 01, 2009
TABLE OF CONTENTS:
  1. · Concluding a Menu for All Browsers
  2. · Important Attributes
  3. · Elaborated Layout Approach
  4. · Advantages of the Simple Layout Approach

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Concluding a Menu for All Browsers - Important Attributes
(Page 2 of 4 )

The table cells have onclick and onmouseover event attributes. These events call functions in the JavaScript code passing the cell IDs and other arguments.

The JavaScript Code

There are four functions. The names of the functions and their roles are:

The dropDownMenu() Function

When you click a drop down button, this function is called. It displays a vertical sub menu below the main link preceding the drop down button you clicked. Before it does that, it first removes any other drop down menu or sub menus that were on the web page.

The react() Function

The background color of a main menu item and that of a sub menu item is brown. For simplicity, in my design the background color of a main menu item (in the horizontal bar) never changes even if the mouse pointer is over it. However, the background color of a sub menu item changes when the mouse pointer is over it.

When the mouse pointer goes over any sub menu item on a drop down menu, the background color of the table cell of the menu item changes from brown to firebrick. Only one bar of firebrick color can be shown at a time on a sub menu. The react() function is responsible for all this.

A sub menu item may have another sub menu, which would come out of its side when the mouse pointer is over the item. If the sub menu is not in the last column on the right of the table, then its sub (sub-sub) menu will come out of its right side. If it is in the last column, then its sub (sub-sub) menu will come out of its left side. The react() function is also responsible for this.

Remember that in our design any sub menu item that can produce a sub menu has the ‘>’ character on its right. Again, in menu parlance you do not really talk about sub-sub and sub-sub-sub menus. All sub menus, independent of their level, are referred to simply as sub menus. You can use the phrase sub-sub or sub-sub-sub when you really want to be precise. You will hardly have to use such phrases.

The react() function also makes sure that only the SPAN elements that are supposed to be displayed are displayed.

The toChoose(ID) Function

When a sub menu is displayed and you click outside the sub menu, the sub menu should disappear. This function sets a variable that is used for that control. We shall see the details later.

The removeSubMenu() Function

This function removes any sub menu (independent of the level) that is displayed. It uses the variable set above for this. We shall see the details for this function and the other three functions later.

I used Internet Explorer, Mozilla Firefox, Netscape and Opera to test the complete code. So far as this series is concerned, Opera and Safari behave similarly to each other.


blog comments powered by Disqus
HTML ARTICLES

- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5
- BBC Adopts HTML 5, Mozilla Addresses Issues
- Advanced Sticky Footers in HTML and CSS
- HTML and CSS Sticky Footers
- Strategy Analytics Predicts HTML5 Phones to ...
- HTML5 Guidelines for Web Developers
- Learning HTML5 Game Programming
- More Engaging CSS3 and HTML Background Effec...
- Engaging HTML and CSS3 Background Effects
- More Web Columns with CSS3 and HTML
- Columns with CSS3 and HTML
- Creating Inline-Block HTML Elements with CSS
- Drag and Drop in HTML5: Parsing Local Files

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 3 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials