Home arrow HTML arrow Page 4 - 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 - The toChoose() Function Continued
(Page 4 of 4 )

Now let's look at the peculiarities. First, know that you can set the cell background color of any of the five browsers we are using (to test the code), using the name of the color (e.g. brown or firebrick). However, when you ask the browsers to return the cell background color, they return the color in different ways.

Internet Explorer, Mozilla Firefox and Netscape return the name of the color. This is what is convenient and it is what we like.

Opera returns the color in hexadecimal form and with small alphabet letters (e.g. #b22222).

Safari returns the color in rgb-decimal form (e.g. rgb(178, 34, 34)).

In order to take account of these three different situations (color by name, color by hexadecimal or color by rgb-decimal), the if-condition tests for these three different return types, using an or-expression. Look at the if-condition in the code earlier in this article to appreciate what I have just said.

So the particularity of the Internet Explorer, Mozilla Firefox and Netscape browsers has been taken into consideration. The particularity of Opera (and any other browser that may behave like it, forming a group) has been taken into consideration. And lastly, the particularity of Safari (and any other browser that may behave like it, forming a group) has been taken into consideration.

Fortunately, the code segment for this is very short, and it is as if all of our code works with all browsers.

Let us take a break. In the next part we shall look at the last of the JavaScript functions.


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