Home arrow HTML arrow Page 3 - Drop Down Functions for a Common Browser Menu
HTML

Drop Down Functions for a Common Browser Menu


In this part of the series, we continue with the JavaScript for the main menu and its sub menus. We will first complete the explanation of the second code segment of the dropDownMenu(ID) function, and then introduce a new feature with it.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
March 27, 2009
TABLE OF CONTENTS:
  1. · Drop Down Functions for a Common Browser Menu
  2. · The Third Segment of the dropDownMenu() Function
  3. · The Third Segment of the dropDownMenu() Function Continued
  4. · The react() Function

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Drop Down Functions for a Common Browser Menu - The Third Segment of the dropDownMenu() Function Continued
(Page 3 of 4 )

The next statement is an if-statement with a number of statements inside. The condition of the if-statement tests to see if the SPAN element exists before its block is executed. It is possible that some cells may be empty and would not have any SPAN element, though we do not have any in our example.

We have developed the ID of a possible existing SPAN element based on the iteration and position number. That is why the condition has to test whether the SPAN element exists before it is displayed. This is a precaution, because we do not know whether if we try to display a SPAN element that does not exist, the software would go into an error state.

We already have the ID of the table cell, and the ID of the SPAN element in the cell at the particular iteration. The background color of the table cell, whose SPAN element is displayed, has to be set to brown as a result. When the background of the cell is colored, the cell becomes opaque, and you cannot see through it. The first line inside the if-block gives a brown color to the background of the cell that has the SPAN element to be displayed. The next line displays the SPAN element, by giving the "block" value to its display property.

The next statement gives the content of "true" to the corresponding cell in Boolean Table. The statement that follows creates the number part of the SPAN element ID that will be written into the corresponding cell in the Number Table.

The last statement writes this number into the corresponding cell. You may ask, why not write the ID? As we go along you will see that we need the number more than the ID (which is the number preceded by S).


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