Hiermenus Go Forth, XXII - DHTML Lab | 8 | WebReference

Hiermenus Go Forth, XXII - DHTML Lab | 8


Logo

Hiermenus Go Forth, XXII:
Version 4.1 - The Complete Script (Full-Window)



Better Child Menu Positioning

The introduction of variable width menus has necessitated the restructuring of the code that positions child menus, since parent menus can be any width and the relative position of child menus is no longer constant.

These changes have resulted in improved positioning algorithms for all child menus, regardless of the width setting.

IE4 and .childNodes

In early versions of HM4 (4.0 --> 4.02) we used a single common-to-all-browsers external script. In an IE4-specific section, we assigned the menu element's children collection to a property named childNodes:

if(HM_IE4) {
    ...
    if(!HM_IE5M) NewMenu.childNodes = NewMenu.children;
}

This allowed us to later use the same code for both IE4 and IE5, since IE5 had a built-in childNodes collection as a result of its DOM support.

When we created browser-specific scripts the naming scheme remained.

HM_CurrentMenu.childNodes = HM_CurrentMenu.children;

If, for some reason, the IE4 script is loaded into IE5, an error is generated when the above statement is executed, since we cannot redefine a built-in property.

Apparently, some authors without access to IE4 have been loading the IE4 script into IE5 for testing purposes. To accommodate this practice, in Version 4.1 we have renamed the childNodes property to items in the IE4 script. Now it can be run in IE5 without problems.

Note:
Version 4.1 makes heavy use of IE properties that reflect actual and displayed element dimensions to determine menu sizing. Some of these properties have different behavior in IE4 and IE5. You will not see what an IE4 user will see by loading the IE4 script in IE5. IE4 testing can only really be done in IE4.
Using IE5 in compatibility mode where it co-resides with IE4 on the same OS is one solution to IE4 access. Another is a dual-boot system with IE4 on one OS and IE5 on the other.

Opera

There has been much mail on the lack of support for Opera.

Opera is a terrific browser. Its CSS and DOM support are good, but it has yet to implement ELEMENT-CREATION-AFTER-PAGE-LOAD:

"Modifying the document structure is not yet possible (ie. you cannot add or remove HTML elements)."

http://www.opera.com/opera5/specs.html#javascript

HM creates all elements after page load. Consequently it cannot be made to work with Opera. When dynamic element creation is introduced, HM will comply.

If we complete the HM4 feature set and Opera has yet to implement the necessary support, and the demand is large enough, an Opera-specific version which uses a different philosophy from the current HM version may be pubished.

Version 4.1 includes a check for Opera use and does not load the HM scripts if Opera is being used.

Konqueror

Likewise, HM does not currently run in the Konqueror browser.

Support for Konqueror is very low priority, but will be addressed again in the future.

Version 4.1 includes a check for Konqueror use and does not load the HM scripts if Konqueror is being used.

Files Changed in Version 4.1

You will need to overwrite previous versions of the above files to upgrade to 4.1.

HM_Loader.js has been changed to include the Opera and Konqueror browser checks. It is recommended, but not essential, that you overwrite any previous version of HM_Loader.js with the new one. It would not be necessary, for example, if HM was being used on a browser-specific intranet. For Web use, you should use the new HM_Loader.js.

On the next page, the sample page included in the download.


Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: August 21, 2001
Revised: August 21, 2001

URL: http://www.webreference.com/dhtml/column58/5.html