DHTML Lab: HierMenus CENTRAL: Version 3 Frameset Instructions, Step 2 - dhtmlab.com | WebReference

DHTML Lab: HierMenus CENTRAL: Version 3 Frameset Instructions, Step 2 - dhtmlab.com

Instructions -
Frameset Menus -
Step 2 of 6

Revised: June 26, 2001



Return to Step 1 Step 2 of 6 Go to Step 3
Place the overhead, browser-detection script in the navigation frame document.

<HTML>
<HEAD>
<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;
//-->
</SCRIPT>

The above script must be placed early in the navigation frame 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.

Return to Step 1
Step 2 of 6
Go to Step 3

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/frameset/step2.html