This one is for readers or the makers of Sitepoints http://www.sitepoint.com/books/jsant1/ JavascriptAnthology.

Situation:
dropdownMenuKeyboard.js (the accessible dropdown menu
of Chapter 16).
I am replacing an old non-accessible and 'non-unobtrusive' menu for this new-school script.

Problem:
The dropdownmenu fails in IE7 for various reasons which are partly beyond my scope of the IE7 DOM support knowledge. It surely has something to do with the stacking order problems the writers mentioned on page 331 (the "obscure and frustrating z-ordering quirk"). It seems that though this problem existed for IE6 and earlier versions, it has been solved for IE7.
This implies that for instance the ternary operator (isie ? li.offsetLeft + 'px' : 'auto'), in which isie stands for Internet Explorer, should not apply to IE7
because stacking of sublevel menu's get's messy when IE7 is included.

Solution:
I managed to get the above script working in IE7, at least better than it did without any adjustment but not fully as per the scripts intention, by adding a browser detection method (dangerous grounds though!) for IE7 as follows (adjustments to original script in red).:


function dropdownMenu(navid)
{
var isopera = typeof window.opera != 'undefined';
//check for IE7 due to incompatibilities of this script with older IE6
var agent = navigator.userAgent.toLowerCase();
var browser = agent.replace(/.*ms(ie[\/ ][^ $]+).*/, "$1").replace(/ /, "");
var isie7 = typeof document.all != 'undefined'
&& browser.indexOf("7.0") != -1;
//for positioning of submenus exclude IE7 from other IE versions,
//only problem is there most likely with createIframeLayer within function //showMenu which now only applies to isie6
var isie6 = typeof document.all != 'undefined'
&& !isie7 //exclude IE7 from isie variable
&& !isopera && navigator.vendor != 'KDE';

//for correct key up and down behaviour see function dropdownTrigger() var isie should also contain IE7
var isie = typeof document.all != 'undefined'
&& !isopera && navigator.vendor != 'KDE';
var issafari = navigator.vendor == 'Apple Computer, Inc.';


In different parts of the script where specific conditions are set for IE I changed isie to isie6, except for the key-events where the script should also apply to IE7.

Question:
I know this is not a perfect and waterthight solution (the submenu's are not flush with the toplevel menu's in IE7) and the IE7 browser detection might not work for newer IE7 builds.
- Has anyone been dealing with the above script for IE7 and if yes, how did he/she manage to make it work
- Is there a specific object detection method that could sort out IE7 only, or does anyone have a better browser detection method than the one I constructed?

Be pleased to here from one of you
Enno