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

Does each menu have an ID?


Poster: Speednet
Dated: Sunday March 20 2005 - 21:25:48 GMT

I would like to be able to refernce an entire menu from a CSS style sheet, which would require that the menu have an ID associated with it.

Does anyone know if each menu is written to the HTML page with an ID?

(The style sheet would refer to the menu as #menuname)

Thanks!


Poster: Ruth
Dated: Sunday March 20 2005 - 22:50:16 GMT

I'm not sure I understand what you mean by reference an entire menu from a style sheet. Do you mean you want to design all the style of the menu, i.e. color, borders, margins etc, in css? There is information here about css menus. Hope this helps.

Ruth


Poster: Speednet
Dated: Monday March 21 2005 - 6:56:11 GMT

I mean the ability to refernce a menu by ID name in a CSS style sheet.

I can refer to every menu on the page by addressing the .mmenu class name in the CSS file, but I wanted to know if I can address a specific menu by referencing #menuname.

I can't think of any way to be more specific. Do you know the answer?


Poster: Ruth
Dated: Monday March 21 2005 - 9:45:46 GMT

As far as I know menus are identified by name. There may be some internal programming that does something else, but that is not something I would know.

The only way I know to put a different css style on a particular menu would be to create .difOff and .difOn classes [named what you want] in the css file and then call them in the style definition that you had created in the menu_data.js file for that particular menu.

Sorry, but my use of css is pretty basic and if there's some other way to apply it to the menu other than the offclass and onclass, I haven't seen it described.

I get the impression you want the browser to read the style sheet, say 'here's a style for this menu in the Milonic DHTML Menu system so apply this style to that particular menu. But, I think you have to create classes in the style sheet and apply them using the offclass and onclass in the menu_data.js file style defintions, then they get applied to the menu from that offclass onclass menu function. Perhaps someone else knows a different way.

Ruth


Poster: Speednet
Dated: Monday March 21 2005 - 13:59:27 GMT

Ruth,

Thanks for your thoughtful reply. You are close on what my intentions are, but let me be more precise:

I have added a style to the style sheet which makes the menu disappear on printouts. To do this right now, I have added the following code to my stylesheet:
Code:
__at__ media print{
.mmenu {
   display : none;
   }
}

Although this code does a great job of eliminating the menu during printouts, it essentially removes all milonic menus from the page, because it hides everything with a class of mmenu.

If each menu had a unique id attribute, instead of
Code:
.mmenu {
I would write
Code:
#menuid {


Is there anyone who knows the JavaScript internals who would know if each menu gets assigned an id attribute? (Andy?)

Much appreciated!


Poster: Andy
Dated: Monday March 21 2005 - 14:15:53 GMT

The id's are numbered zero to whatever and are like menu0, menu1, menu2 and so on.

Should be able to use #menu0 {} but never tried it.

Hope this helps,
Andy


Poster: Speednet
Dated: Monday March 21 2005 - 14:53:48 GMT

Based on the order that they are built, right?

Is there any way to specify an ID?

Thanks very much.


Poster: Andy
Dated: Monday March 21 2005 - 15:31:54 GMT

Yes, it will be in order.

There is also a function called getMenuByName("mainmenu") that will return the reference number of the menu.

Cheers,
Andy


Poster: Speednet
Dated: Monday March 21 2005 - 15:39:30 GMT

Thanks for the tip on the getMenuByName() function. The only problem with that is that it cannot be used in a CSS file. Maybe if there were an option to set the actual ID yourself? (New feature possibly?) That would help greatly in the separation between content and functionality.


Poster: Speednet
Dated: Tuesday March 22 2005 - 12:15:46 GMT

Bump.

Andy, would you have a quick answer for this? Thanks very much.


Poster: Andy
Dated: Tuesday March 22 2005 - 12:30:24 GMT

Not sure it's going to be possible.

The menu sets and uses the ID for internal stuff. I'll have a think and see if there is another way.

-- Andy


Poster: Speednet
Dated: Tuesday March 22 2005 - 12:43:13 GMT

OK, thanks. I've got the notify option set on this thread, so if you come up with something I'll see it if you post here. Thanks for all your help.