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


Poster: Venky
Dated: Wednesday December 31 2003 - 13:16:31 GMT

First off, a wonderful & prosperous New Year to all, especially to the Milonic team

Well... let me see if i can put this question correctly.

In the menu scripts, if a page is included in the script, then the pagebgcolor takes effect when the browser is viewing that particular page.

However, how can one force or set the pagebgcolor when the current page is "outside" the menu script (i.e., when the current page is not included in the data script file)

In the above URL, "interact with us" and "mailing lists" use the pagebgcolor.

Now, see
Here, i would like to force the pagebgcolor on one particular menu item.

Is this possible? I would prefer to use the same menu data file and not a different one

Thanks in advance for any ideas/ suggestions/ comments


Poster: Ruth
Dated: Thursday January 1 2004 - 6:16:01 GMT

I found one way to do it. I chose to make the interactive highlight when you go to that page...well the test page I put up, just like the one you had as an example. In the menu_data4-mine.js file [it's your file with the one change I made] I inserted this as the last item in the submenu called interactive

aI("text=<img src=clear.gif border=0>;url=;status=Participate in various Sevas at the Peetham in Kanchipuram;itemheight=1;");

you note there is no text, just an image that is 1px by 1px and transparent, and I put the itemheight at 1. What happens is with that Interactive becomes red when you're on that page and if you mouse over it, with no text in that item the interactive submenu looks like it has a small [well 2 or 3px] red border on the bottom. Here's a test page to show you what happens.

It works in IE5, Netscape 6 & 7 and Opera 7..though some weird thing is happening in opera..the menu scrolls slowly off the right of hte page as it's loading until it's no longer there.

There may be some coding way to do what you want, but I don't know anything about code. Good luck, have a great new year.


Poster: kevin3442
Dated: Saturday January 3 2004 - 0:24:01 GMT

Hi Venky,

I'm thinking that you could do what you want by programatically changing the offbgcolor of the specific menu item when the page in question loads. To do this, you need to (1) figure out the unique item index for the menu item in question and (2) change the offbgcolor property for that item when the page loads. I have been playing with some methods of dynamically changing menu item properties and menu properties programatically. I have two functions that you could use. They are:
function mm_getItemByName(menuName, itemName)
  menuName = menuName.toLowerCase();
  for (i=0; i<_mi.length; i++)
    if (_mi[i][1] == itemName && _m[_mi[i][0]][1] == menuName) return i;
  return -1;

function mm_changeItemProperty(menuName, itemName, codeRef, newValue)
  var itemNum = mm_getItemByName(menuName, itemName);
  if (itemNum == -1) return;
  _mi[itemNum][codeRef] = newValue;

You could include these functions at the top of your /newlayout/template/menu_data4.js file, or (since they'll only be used on one page) put them in a separate .js file that you source into your page. The function that you will use directly is as follows:

mm_changeItemProperty(menuName, itemName, codeRef, newValue)
This function takes four parameters.

(1) menuName is the name of the menu containing the item you want to change; this name is given in the code that creates the menu. It is not case sensitive. For example, your main menu is created with the following code:
with(milonic=new menuname("Main Menu")){

The name of the menu is given in the first line as 'Main Menu'.

(2) itemName is the name of the item whose properties you want to change. Since there is no internal item name, I use the text that appears in the menu item, and so the itemName is given in the text= property of the aI() function that defines the menu item. It is case sensitive. So, for example, in your 'Main Menu', you have a 'Downloads' item defined like so:

The itemName of this menu item is therefore 'Downloads'. Again, it is case sensitive.

(3) codeRef is the number or "code reference" of the property that you want to change. Each menu item property has a unique "code reference" number; these numbers are found in the "Code Ref" column of the table that lists the menu item properties on the quickrefs page for menu item properties. For example, the codeRef for the offbgcolor is 7.

(4) newValue is the new value that you want to assign to the identified menu item property, for the targeted menu item. This might be a numeric or a string value, depending on what type of property you are changing (a color would be a string).

For example, the offbgcolor for the items in your 'Main Menu' is defined in your current menuStyle as "#ffffff". Suppose you wanted to to change the offbgcolor of the 'Downloads' item in the 'Main Menu' to "#F26E26" (the pagebgcolor from the same style). You could do this with the following function call:
mm_changeItemProperty('Main Menu','Downloads',7,'#F26E26');

To get that to happen automatically when the page loads, you'd call the function in your html code, using the body's onload event, like so:
<body onload="mm_changeItemProperty('Main Menu','Downloads',7,'#F26E26');">

It seems like a lot just to get one item's background color to change, but it's really more difficult to explain than it is to implement. I hope it made sense!

Note to anyone else who is interested... In theory, the above mm_changeItemProperty() function can be used to change any menu item property. But there are over 70 item properties, and I haven't tested them all! So far, however, my tests look good, having changed the menu item's various colors, width, justification, url, text, showmenu, and others. Note, however, that I have only tested these in IE6, NS7, and OP7.2 under Win2k, so there're lots of other browser/os combinations I have yet to test. If you test the functions successfully in other browser/os combos, please let me know!

Hope that helps,