Hiermenus Go Forth, I - DHTML Lab | 11
Hiermenus Go Forth, I:
Version 4 - The External Arrays
The Top-Level Menu Array
The first element in every top-level menu array (HM_Array1, HM_Array2, etc.) is an array containing parameters that affect the complete menu tree, that is, the top-level menu being defined and all child menus that may appear in its cascade. We will refer to the parameters in this array as the Tree-Specific Overhead Parameters
The Tree-Specific Overhead Parameters
There are seventeen Tree-Specific Overhead Parameters. Providing values for any of these is OPTIONAL. If you provide no value, a null value or an empty string ("") value, there are no adverse effects. Default values for the parameters exist elsewhere and will kick in. These default values may be in the in-page parameters, to be discussed next column, or in the main external script.
We will not discuss setting the default values in this column, since we are dealing only with the arrays.
The Tree-Specific Overhead Parameters are defined in this order:
HM_Array1 = [ [ 0 width, 1 left_position, 2 top_position, 3 font_color, 4 mouseover_font_color, 5 background_color, 6 mouseover_background_color, 7 border_color, 8 separator_color 9 top_is_permanent, 10 top_is_horizontal, 11 tree_is_horizontal, 12 position_under, 13 top_more_images_visible, 14 tree_more_images_visible, 15 evaluate_upon_tree_show, 16 evaluate_upon_tree_hide ] ... ]
Element 0 - width
- Description
- Sets the menu width for the menu tree. All menus in the cascade (top-level and children) are affected.
- Value
- Pixels.
May be specified as:- integer
- string
- string JS expression to be evaluated
- Example Values
- integer: 150
- All menus in the tree will be 150 pixels wide.
string: "150"- All menus in the tree will be 150 pixels wide.
JS expression: "getWidth()"- A custom function that you have created will be called. The return value of this function will be the width parameter, and all menus in the tree will comply.
- The complete JS code is included as the array element. In the above example, width will be 150 if the browser window is less than 800 pixels wide, and 200 if it is not.
- Default
- Set by author using the In-Page Parameters.
- Differences from Version 3 equivalent
- Version 3 accepted only integer values.
Notice that we are introducing multiple value-types for our parameters. A common error in using Version 3 was to include strings where integers were called for and vice-versa. Version 4 will accept either when a number is called for, and in many cases (like the above) will even accept a JS expression. The use of function calls and in-line JS statements gives you the ability to easily provide conditional values and to expand the script functionality.
So, let's look at the next parameter-elements.
Produced by Peter Belesis and
All Rights Reserved. Legal Notices.Created: Aug 08, 2000
Revised: Aug 08, 2000
URL: https://www.webreference.com/dhtml/column35/7.html