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:41

Need to dynamically change milonic "style" after d

Poster: bjminihan
Dated: Tuesday June 14 2005 - 21:17:50 BST


We're implementing Milonic for our intranet site (thus, no samples, sorry)...and I've gotten pretty far with it...

The problem is that I need to be able to change the "style=" property for a single menu on a page and all of its submenus, after the menu as already been built.

Each menu is being built and rendered on the page by way of "gadgets" in the Plumtree portal environment. All of the menu details are stored in the gadget's database and built when the page loads.

The problem is that the gadget, while building the milonic menu data to put into the page, doesn't know which side of the page it's on. We want to have menus on the right side of the page display in "rtl" mode, while menus on the left side of the page display in regular mode.

Since I don't know where (on the page) I am, and can't detect it via server side code, I have to build every menu in the default openstyle format.

That leaves me with the problem I have - after the menu is build and displayed in the page, I need to change its style and its submenus style properties to something else, so they'll render in "rtl" mode.


with (milonic=new menuname("ABC Testing Menu")) {
aI("text=What's New and What's going on in the world;image=http://localhost:8080/custom/icons/mnu_pdf.g

I want to change the above bold line to:

I already figured out (by reading tons of archive notes) how to change the openstyle property, but I really need to change the subimage source, as well.

Can anyone help?

Poster: Ruth
Dated: Tuesday June 14 2005 - 21:45:21 BST


Are you using the changeMenuProperty, or changeItemProperty functions to do the change in the openstyle? If you are you should be able to use the same function to change the subimage.


Poster: bjminihan
Dated: Tuesday June 14 2005 - 23:01:23 BST

I'm using changeMenuProperty, but it didn't seem very pleased when I tried to send in a new milonic menu object for "style"...

Here's my function:

function mm_changeMenuProperty(menuName, propertyRef, newValue) {
var menuNum = getMenuByName(menuName);
_m[menuNum][propertyRef] = newValue;
document.write("new prop = " + _m[menuNum][propertyRef] + "<br>");

function setRTLMenu(sMenus) {
var sGID = "<%=GID%>";
if (!_eit_mnu3_isLM2(parseInt(sGID)) && sMenus.length > 0)
// render as right-to-left menu
document.write ("this is a right-hand menu - " + sGID + "<br>");

var aMenus = sMenus.split(",");
for (var i=0; i< aMenus.length; i++)
mm_changeMenuProperty(aMenus[i], 11, "rtl");
mm_changeMenuProperty(aMenus[i], 6, menuRTLStyle);

I tried changing property 6 with "menuRTLStyle" in quotes but neither method worked. I didn't get an error, but I could no longer click the main menu items to view the submenus.

Poster: Ruth
Dated: Wednesday June 15 2005 - 0:28:51 BST


Style is one of the properties that you cannot change using the function. There is another function that you can use to change item properties, I think you could use that to change the subimage, which isn't a menu propery, so I don't think you can use the changeMenuProperty function for that.

Here is the demo for the changeItemProperty() which has a more indepth explanation, and here is the main one BUT you won't be able to actually use the demo to see it work. There is a little bug in 5.726 which is fixed in 5.727 when it comes out. Anyway, the demo page does have all the info on using the function.

I don't know if you can incorporate this into your 'gadget' like you did the other one. I am not a function person, so I can't really help even though I understand, after reading the explanations, what it's doing, I have no idea how it's doing it :( Other than this, I don't know what to suggest.

If this is a purchased license, you might contact Milonic about the issue. You should have addresses to contact them. I'm sorry I can't be more help.



Poster: bjminihan
Dated: Wednesday June 15 2005 - 0:55:25 BST

I kind of figured it wasn't going to be possible, without some in-depth knowledge of how style objects are assigned. I'd look into the source code if I had the time...

Oh well...thanks for the tip on contacting support. Hadn't even thought to try that yet =]

If I figure something out I'll try to repost to my note so others can benefit =]

Poster: Ruth
Dated: Wednesday June 15 2005 - 1:40:39 BST

I take it you can't use the changeItemProperty() to do what you want, but I did have another thought. If you used something other than an arrow it wouldn't matter the openstyle direction. There are a lot of Milonic created images here. The ones that came to mind are here These are a lot of different shapes, squares, circles etc. I have used them on some demos which have an option to click and change the menu from vertical to horizontal. That meant I didn't have to mess with coding the images in the function or uploading twice the number of images.


Good point...

Poster: bjminihan
Dated: Wednesday June 15 2005 - 1:48:25 BST

...but =]

The menu I'm building is version 3 of an existing system. Milonic is replacing the render portion of the menu, but the admin and user expectations are that the menus will still behave identically to the older versions (with several new features, care of Milonic).

Also, in usability testing these menus, most participants felt the arrow was important for indicating in which direction the menus would open...

Good idea tho =].

My fallback plan is to provide a preference in our menu builder system. If the user puts the "gadget" on the right side of the page, he would say (via preference) "This menu should open to the [left]", and it will then build the menu appropriately. I'd rather do it automatically, but if it really can't be done (somewhat painlessly), guess it'll have to do...

Poster: BigWebGuy
Dated: Wednesday June 15 2005 - 14:17:04 BST

bjminihan, i had the same issue a while ago.

see thread:

Andy chimed in and pointed me to this function he wrote to change the style, it works on the demo link provided but i havent been able to get it to work properly on my site. unfortunately i havent been able to troubleshoot my implementation very much as i have been pulled off that project for a bit, but let us know if you get it working on your site. hopefully i will get a chance to get mine working too.

it can be done!


Poster: John
Dated: Wednesday June 15 2005 - 17:25:34 BST

BJ, please see if you can get at least a test page posted so we can get a better look at what's happening.