DHTML Lab: HierMenus CENTRAL: Version 5 Setup - Step 1
V5 Setup Instructions
Step 1 of 6
|
The following script must be placed early in your document. It is available to all JavaScript-enabled browsers. If you are using the cross-frames feature of HierMenus, this script should be placed in the head of your navigation page:
<HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> <!-- if(window.event + "" == "undefined") event = null; function HM_f_PopUp(){return false}; function HM_f_PopDown(){return false}; popUp = HM_f_PopUp; popDown = HM_f_PopDown; //--> </SCRIPT>
Four dummy functions are declared, HM_f_PopUp(), HM_f_PopDown(), popUp() and popDown(). These functions may be called by links in the document, links that are visible to all browsers. The actual functions are redeclared in the menu script later, for menu-enabled browsers. By placing these "dummy" functions here, older browsers will not generate an error when they encounter a menu-enabled link since they will find and execute these dummy versions. HM_f_PopUp() and HM_f_PopDown() are the actual functions declared in HierMenus; the other two functions are provided for compatibility with previous versions of HM that used popUp() and popDown().
Fourth generation browsers have a built-in event object, passed as an argument to HM_f_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 an HM version 4+ environment only, and you are only using permanently visible menus (i.e., you are not using onMouseOver and onMouseOut within existing page links to display your menus - more on this later), you may omit this step. Cross-frames implementations must include this step, of course, since cross-frames implementations must use in-page links.
|
Produced by Peter Belesis and
Created: April 22, 2003
Revised: April 22, 2003
URL: https://www.webreference.com/dhtml/hiermenus/instructions/step1.html