DHTML Lab: HierMenus CENTRAL: Version 3 Full Window Instructions, Step 1 - dhtmlab.com | WebReference

DHTML Lab: HierMenus CENTRAL: Version 3 Full Window Instructions, Step 1 - dhtmlab.com

Instructions -
Full Window (No Frames) -
Step 1 of 5

Revised: June 26, 2001

View all StepsStep 1 of 5Go to Step 2
Place the overhead, browser-detection script in the HEAD of your document

<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
     NS4 = (document.layers);
     IE4 = (document.all);
    ver4 = (NS4 || IE4);
     IE5 = (IE4 && navigator.appVersion.indexOf("5.")!=-1);
   isMac = (navigator.appVersion.indexOf("Mac") != -1);
  isMenu = (NS4 || (IE4 && !isMac) || (IE5 && isMac));
function popUp(){return};
function popDown(){return};
if (!ver4) event = null;

The above script must be placed early in your document. It is available to all JavaScript-enabled browsers. It determines whether the user's browser is menu-compatible.

Currently, the menu script works on fourth and fifth generation browsers, with the exception of IE4 Macintosh. The type of browser-detection used here is discussed in detail in DHTML Diner.

Two dummy functions are declared, popUp() and popDown(). These functions are called by links in the document, links that are visible to all browsers. These functions are re-declared in the menu script later, for menu-enabled browsers. Older browsers will not generate an error since they will find and execute these dummy versions.

Fourth generation browsers have a built-in event object, passed as an argument to popUp(). Old browsers do not have this object, so they consider event to be a user-defined variable. We must, therefore, define it as a dummy variable for these browsers to again avoid errors.

Note: If you are writing for a version 4+ environment only, the final three statements in the script can be omitted.

View all Steps
Step 1 of 5
Go to Step 2

Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: July 20, 1999
Revised: June 26, 2001

URL: http://www.webreference.com/dhtml/hiermenus/version3/instructions/noframes/step1.html