Home arrow HTML arrow React and ToChoose Functions for a Menu for All Browsers
HTML

React and ToChoose Functions for a Menu for All Browsers


Welcome to the sixth part of a nine-part series that shows you how to build a menu for all browsers. In this part we continue to take a look at the JavaScript functions, specifically the react() and toChoose() functions.

Author Info:
By: Chrysanthus Forcha
Rating: 3 stars3 stars3 stars3 stars3 stars / 2
June 10, 2009
TABLE OF CONTENTS:
  1. · React and ToChoose Functions for a Menu for All Browsers
  2. · The Parameters of the react() function
  3. · The toChoose() Function
  4. · The toChoose() Function Continued

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
React and ToChoose Functions for a Menu for All Browsers
(Page 1 of 4 )

The react() Function Details

The arguments for this function are not really the ones we saw in the previous series. This function is called when the mouse pointer goes over a drop down menu or sub menu item. Each of the cells for these items has an onmouseover event attribute. One of attributes is:

onmouseover = "react('TD11','1','sub','5')"


Now let us look at the function. Here it is:


function react(ID,colNo,submenu,noRows)

{

//first make sure all background colors of the sub menu cells are brown.

for (i=0; i<noRows; i++)

{

//form the ID

theID = "TD" + i + colNo;

document.getElementById(theID).style.backgroundColor = "brown";

}


//let the background of the current sub menu cell be firebrick.

document.getElementById(ID).style.backgroundColor = "firebrick";


//remove any lower sub menu that was displayed before you display the new one

if (ID.length == 4)

remove2NumID();

else if (ID.length == 5)

remove3NumID()


//display sub menu

if (submenu == "sub")

{

//ID of sub table

beginslice = 2;

endslice = ID.length;

slicedStr = ID.slice(beginslice,endslice);

IDSUB = 'ST' + slicedStr;

document.getElementById(IDSUB).style.display = "block";

document.getElementById(IDSUB).style.visibility = "visible";

}


}



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