PDA

View Full Version : AnyLink Drop Down Menu



alexzey
01-14-2006, 03:22 PM
appeared with Internet Explorer 6.0 (Win XP)
condition: function dropdownmenu called in a link without value for 4th parameter (menuwidth)


Hello,

I used the AnyLink Drop Down Menu (http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm) at http://www.amateurtheater.de/ (red navigation menu) without a setting for menuwidth (4th parameter) in onMouseover to call function dropdownmenu:


<a href="/online/" onMouseover="dropdownmenu(this, event, menu_online)" onMouseout="delayhidemenu()">Online</a>

"No problem", I thought. "A default value is given."


var menuwidth='165px' //default menu width

But when I checked my pages with IE 6 I received an error. After some trail and error I found the reason within function showhide:


function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (menuwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

If menuewidth is not set at function call of dropdownmenu (onMouseover), then menuewidth is not empty (menuwidth!="") but undefined (the default value of menuwidth is overwritten by function call).

My solution: I modifed the "if" statement:

if ((typeof menuwidth!="undefined") && (menuwidth!="")){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
}

Hope, you can follow my thought with this explanation and this bug is not only an error of me. :)


alexzey