Home arrow HTML arrow Page 2 - Producing Sub Menus for a Common Browser Menu
HTML

Producing Sub Menus for a Common Browser Menu


In this seventh part of a ten-part series on building a menu that works in all browsers, we shall continue with our in-depth analysis of the react() function. This is the longest function in this series. In this part we shall treat the details of the sixth code segment.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
April 17, 2009
TABLE OF CONTENTS:
  1. · Producing Sub Menus for a Common Browser Menu
  2. · More Description of the Sixth Code Segment
  3. · The Statements of the Sixth Code Segment
  4. · The Matching

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Producing Sub Menus for a Common Browser Menu - More Description of the Sixth Code Segment
(Page 2 of 4 )

SPAN elements occur in drop-down menus and in sub menus of different levels. This is how we gave the ID to a SPAN element. The last two numbers are the row and column numbers of the cell, where the SPAN element resides. The preceding two numbers are the row and column numbers of the cell (root) that gave rise to the sub menu having this SPAN element. The pair of numbers preceding this one is the row and column number of some grandparent root, and so on.

There can be more than one SPAN element in a cell. If the number part of the ID of the SPAN element has two numbers, we know that it has to be displayed by the drop down button. If the number part has four digits, we know that the SPAN element has to be of a sub menu that emanates from a drop down menu (the fifth segment handles this).

If the number part of the ID has more than four digits, then it starts becoming difficult to determine its ancestor source. You can still determine the ancestor cell that gave rise to the SPAN element in question, using the numbers in the ID. I call the immediate ancestor cell that gives rise to the SPAN element in question, the root.

When the react() function is called, all of the SPAN elements whose IDs have number parts with digits greater than or equal to four are sent in an array; the parameter for this in the react() function is spanArr. I said something like this in one of the previous parts of the series. However, I have to make a distinction here: each of the numbers is sent without the last two digits. You will see why below.

When the number part of the ID has more than four digits, the possible roots for these SPAN elements are sent in another array; the parameter for this in the react() function is rootArr. The sixth code segment has to look for matches between the numbers of the SPAN elements in the spanArr array and the numbers of the root IDs (cell IDs) of the rootArr array. When a match occurs, the SPAN element is displayed. Only one SPAN element can be displayed in a cell for any sub menu. The set up is such that only one match can occur for a cell.


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 4 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials