Changing the border of the menu on events

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
istewart
Beginner
Beginner
Posts: 2
Joined: Tue Jun 28, 2005 1:08 am

Changing the border of the menu on events

Post by istewart »

Hi Everyone,

I hope this is an easy question. I'd like to be able to change the border of the menu based on different events.

I would like the border off by when the menu is not active.
If the menu is activated, I would like the border turned on.
When the menu collapses after something has been selected, I would like the border to shut back off.

I've tried this code snippet, but I'm not sure why it doesn't work: (No errors, just no functionality =)

with(mainMenu=new menuname("Main Menu")){
style=menuStyle;
...<snip>


Then, later on , in an onfunction method --

mainMenu.style.bordercolor='#ffffff';


But that doesn't seem to have any effect. I can see in my debugger that the value of that property is changing, but there isn't any visual change on the page. Is there a method or something that needs to be called? I've tried recalling drawMenus() to no effect.

Thank you in advance!

-Ian
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

There is a parameter called onborder with the syntax of onborder="1px solid #ff0000"; It is actually applied to items, since it is an item that gets activated onMouseOver and not the whole menu. So, if you used the above when you moused over an item the border around that item would be red in color, and when you moused off it would disappear. There is also a changecolorsbyclick.js module and you can see how that works in this demo I don't think it has yet included the border, but these modules are updated and I have no way of knowing if that has been included.

There are also a clickclass property and a clickfunction property. For the clickclass property you would create a class as to what you want when the item is clicked, then you'd call it using clickclass=yourclassname; I think you can call it either in the 'global' style or in the menu item.

There is also a clickfunction, that would be used to call your function when the mouse is clicked clickfunction=yourfunction; again I think you can put that either in the global style or the item.

If they are in the global style you need clickclass="classname"; or clickfunction="functionname"; in the item you would leave out the " marks.

I'm sorry I can't be more indepth but I don't know how to write functions so other than knowing these things are available, I'm not really sure on using them. Hope this helps.

Ruth

clickclass
istewart
Beginner
Beginner
Posts: 2
Joined: Tue Jun 28, 2005 1:08 am

Post by istewart »

That worked great. Thank you. =)

-Ian
Post Reply