Home arrow HTML arrow Making a Common Browser Menu React

Making a Common Browser Menu React

Welcome to the fifth part of a ten-part series that shows you how to make a drop-down browser menu that works on multiple browsers. In this part of the series, we begin an in-depth analysis of the react() function, which is the function that responds to the onmouseover event for each table cell.

Author Info:
By: Chrysanthus Forcha
Rating: 5 stars5 stars5 stars5 stars5 stars / 2
April 03, 2009
  1. · Making a Common Browser Menu React
  2. · Third Code Segment of the react() Function
  3. · Details of the react() Function
  4. · The Fourth Code Segment: Details

print this article

Making a Common Browser Menu React
(Page 1 of 4 )

The react() Function Code Segments

When the mouse pointer is over a table cell having a SPAN element displayed, the react() function changes the background color of the table cell from brown to firebrick. While in the column, if the mouse pointer goes over another similar cell, the background of the former cell should return to brown, while that of the present cell should become firebrick.

If the SPAN element of the present cell has the > character, the react() function displays the sub menu whose root is the present cell. If the mouse pointer goes on to another cell of the present column, the sub menu developed from the > above should disappear. This function can produce sub menus of different levels that are related by moving the mouse pointer onto lower sub menus on items that have the > characters.

There are seven code segments in this function. The first six are inside an if-statement. The last one is outside the if-statement. As you know, for any SPAN element that is displayed, the background color of its table cell is made brown. Any of the six segments in the if-statement will only have an effect if the background color of the cell the mouse is on is brown, meaning that a SPAN element in the cell is displayed. So any of the six segments will only have an effect for a cell if that cell has a SPAN element displayed.

The First Code Segment

This segment gets the column number of the cell in the table from the tdID parameter (whose argument has the ID of the table cell). We need this column number later.

The Second Code Segment

As we said above, when the mouse pointer is over a cell whose background color is brown, the background color will be made firebrick. Now, if the mouse pointer goes over another cell whose background color is brown in the same column, the firebrick color of the previous cell has to be turned back to brown. The segment turns all the background colors in the column to brown. By doing this, the background color of the previous cell is turned to brown. More details on this later!

blog comments powered by Disqus

- Does HTML5 Need a Main Element?
- Revisiting the HTML5 vs. Native Debate
- HTML5: Not for Phone Apps?
- HTML5 or Native?
- Job Hunting? Freelancer.com Lists This Quart...
- HTML5 in the News
- Report: HTML5 Mobile Performance Lags
- The Top HTML5 Audio Players
- Top HTML5 Video Tutorials
- HTML5: Reasons to Learn and Use It
- More of the Top Tutorials for HTML5 Forms
- MobileAppWizard Releases HTML5 App Builder
- HTML5 Boilerplate: Working with jQuery and M...
- HTML5 Boilerplate Introduction
- New API Platform for HTML5

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


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