DHTML Lab: HierMenus CENTRAL: Version 4 Setup - Step 1 - dhtmlab.com | WebReference

DHTML Lab: HierMenus CENTRAL: Version 4 Setup - Step 1 - dhtmlab.com

V4 Setup Instructions
Step 1 of 6


View all StepsStep 1 of 6Go to Step 2
Place the overhead, function-declaration script in the HEAD of your document.

The following script must be placed early in your document. It is available to all JavaScript-enabled browsers:


<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 re-declared 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 a version 4+ environment only, and you are only using permanently available 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.

View all Steps
Step 1 of 6
Go to Step 2

Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: February 1, 2002
Revised: February 1, 2002

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

Justtechjobs.comFind a programming school near you






Online Campus Both