Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:35

5.773 minor bug: openonclick param and top menu item w/ url


Poster: rybskej
Dated: Thursday May 17 2007 - 21:09:29 BST

I ran into a small bug when upgrading to 5.773 from 5.762 today:

mmenudom.js throws a javascript error when clicking a top menu item that has "url" property defined, is not a sub-menu, and the top menu has "openonclick=true" defined as a property.


To recreate the bug in the default menu_data.js file from the 5.773 distribution, add:
openonclick=true;

to the menuStyle object definition, and watch for javascript errors when clicking a non-submenu item in the top-level of the menu. You may need to change the target URL to something invalid (that will timeout) to give yourself enough time to see the javascript error before the page location changes.

The error is in mmenudom.js, which is (incorrectly?) calling the function:
function _5($){return eval($)}

after you click on an item that has a URL defined but is not a submenu. The value of the input param "$" is the value of the url param. So, for example, for a menu item:
aI("text=Home;url=http://www.milonic.com/;");

the _5 function attempts to eval the string "http://www.milonic.com/", which thows a javascript syntax error while the page is being redirected to that URL. It is functionally non-harmful, in that the user's page does still at least redirect to that URL, but might cause issues depending on what is being eval'ed.

Version 5.762 of the Milonic menu did not have this issue.

A temporary solution I found is to redefine the _5 function as follows:
function _5($){try{return eval($)}catch(e){}}

It is not clear whether or not this solution will cause other issues with the menu system. Thus, it is recommended that for this be correctly fixed, the menu system should prevent the _5 function from being called in the first place when a menu item is clicked to redirect to a new URL, that item is not a sub-menu, and the menu in which the item is located has the "openonclick=true" property defined.