Home arrow HTML arrow Page 4 - Completing the React Function of a Common Browser Menu
HTML

Completing the React Function of a Common Browser Menu


In this eighth part of a ten-part series on building a common browser menu, we treat the last code segment of the react() function. This is the last part of the in-depth analysis we are making of the react() function.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 1
April 24, 2009
TABLE OF CONTENTS:
  1. · Completing the React Function of a Common Browser Menu
  2. · Explanation of the Seventh Code Segment
  3. · Explanation of the Seventh Code Segment Continued
  4. · Cleaning Up for Previous Sub Menus

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Completing the React Function of a Common Browser Menu - Cleaning Up for Previous Sub Menus
(Page 4 of 4 )

We have another if-statement. The value of slicedStr is the slice from otherSpanNo. The condition of this if-statement tests to see if slicedStr is not equal to spanNo. If that test returns true, then we can go on to do the actual cleaning; that is, the statements in the if-block will be executed. These statements are the final statements in the code segment.

When slicedStr is not equal to spanNo, it means that the cell at the iteration has to be cleaned up. Cleaning up means you get the copy of the SPAN element from the Copy Table and place it in the corresponding cell, which is the cell at this iteration. The value of the display property of the copy is "none." So the copy is not seen in our table.

The first statement in the if-block forms the ID of our cell at the iteration. The second statement forms the ID of the corresponding cell at the Copy Table. The next statement makes a copy of the SPAN element from the Copy Table into our table. When no SPAN element is displayed in a cell of our table, the background color has to be transparent. The next statement makes the background color of the cell transparent. The last two statements give the value “” as content to the corresponding cells in the Boolean and Number Tables respectively.

All of this occurs n the seventh code segment, and everything in the react() function happens so fast that the user will not notice it.

Some of Your Worries

You may ask, “Why not change the value of the display property of a SPAN element using the SPAN’s ID and the getElementById() method?” This may work with one browser and not work with other browsers. We need an approach that will work with as many browsers as possible.

There are many questions like this that you may ask in this series. That answer is that we keep using an approach that works with as many browsers as possible. That is why the design is not straightforward.

We have finished with the details of the seventh code segment. The react function is the longest function in this series. We have to see the details of two more functions. These are short functions. We continue in the next part.


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

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