Does each menu have an ID?

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
Speednet
Super Advanced
Super Advanced
Posts: 33
Joined: Thu Nov 25, 2004 4:29 am

Does each menu have an ID?

Post by Speednet »

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!
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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
Speednet
Super Advanced
Super Advanced
Posts: 33
Joined: Thu Nov 25, 2004 4:29 am

Post by Speednet »

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?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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
Speednet
Super Advanced
Super Advanced
Posts: 33
Joined: Thu Nov 25, 2004 4:29 am

Post by Speednet »

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: Select all

@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: Select all

.mmenu {
I would write

Code: Select all

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

Much appreciated!
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

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
Speednet
Super Advanced
Super Advanced
Posts: 33
Joined: Thu Nov 25, 2004 4:29 am

Post by Speednet »

Based on the order that they are built, right?

Is there any way to specify an ID?

Thanks very much.
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

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
Speednet
Super Advanced
Super Advanced
Posts: 33
Joined: Thu Nov 25, 2004 4:29 am

Post by Speednet »

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.
Speednet
Super Advanced
Super Advanced
Posts: 33
Joined: Thu Nov 25, 2004 4:29 am

Post by Speednet »

Bump.

Andy, would you have a quick answer for this? Thanks very much.
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

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
Speednet
Super Advanced
Super Advanced
Posts: 33
Joined: Thu Nov 25, 2004 4:29 am

Post by Speednet »

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.
Post Reply