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: Archived Topics for the old Version 3.0 JavaScript Menu
Forum Topic: Click to view post
Last Updated: Wednesday July 18 2012 - 06:07:21

Calling other functions when i start and exit the menu

Poster: chemicalX
Dated: Thursday October 17 2002 - 16:05:30 BST

Hi guys.

I have a tricky question.

I want to call a function as soon as i start using the menu and another as soon as I exit the menu. I got the exit working, as I just put a call in the closeallmenus function.

Where do I need to put the call that i want to execute when I hover over the first level items. I can't use the popi function, because that gets called everytime a new menu item is popped up.

Please could someone help me?


Poster: kevin3442
Dated: Friday October 18 2002 - 5:33:46 BST

Hi chemicalX,

If I understand you correctly, the offfunction alternate property might serve your purpose (you might also find onfunction useful). You would want to use the property in your first level item definitions. The Activating Functions example discusses these alternate properties and provides and example that you can download.

Hope that helps,


Poster: chemicalX
Dated: Friday October 18 2002 - 7:15:17 BST

Hi Kevin.

Thanks for your reply, I'll take a look at the example you linked and let you know if I got anywhere.


Poster: chemicalX
Dated: Friday October 18 2002 - 8:41:33 BST

Kevin, me again.

Okay, that didn't work :) heheh.

I tried what you suggested, and it looked like this

  ,"Hide combos","onfunction=HideCombos();offfunction=ShowCombos();",,,0

The "HideCombos()" function is used to hide all select boxes in the document, and the "ShowCombos()" is used to show them again. This is to get past the menu going under any dropdown boxes. I tried the sample that you had to put the entire form into a div, and that didn't work either.

Putting the "HideCombos()" function call in the "popi" function works, but then it calls it every time that I move over a new work item, which slows my browser down to a grinding halt, as it loops through the whole form every time I call the function.

The "ShowCombos()" function is working perfectly, cos I call that in the "closeallmenus" function. It's just the start that I need to get sorted out.

So, in essence, what I wanna do is call the "HideCombos()" function as soon as I hover over the first menu item (start using the menu), and call the "ShowCombos()" function again when I exit the menu (which I've done)

And that's it :)

Thanks again for your help Kevin.

PS: Another thing is that I still want the dropdown menu to pop up for the menu item when I hover over it, so I need to keep the "show-menu=downloads" section.

Poster: kevin3442
Dated: Thursday October 24 2002 - 0:46:35 BST

Hi Johann,

You say it didn't work, but I'm wondering what the actual result was. Did you get anything? Not sure if this'll get you any further but I think that your code,
,"Hide combos","onfunction=HideCombos();offfunction=ShowCombos();",,,0

should actually be
,"Hide combos","# onfunction=HideCombos();offfunction=ShowCombos();",,,0

Note the # in place of an actual URL.

In the case where you need to use show-menu in the URL field, you could put the onfunction and offfunction calls in the alternate URL field, like this:
,"Downloads","show-menu=downloads","# onfunction=HideCombos();offfunction=ShowCombos();",,0

Of course, the onfunction is called every time you mouse over the menu item and the offfunction is called every time you mouse out, which is probably what you want to implement in a drop-down menu that overlaps a select field.

BTW, I'm just a user like you, so the examples on the Milonic website aren't mine. I've never actually tried the DIV trick to hide form elements, but it does seem to be the approach that most people discuss here.



Poster: chemicalX
Dated: Thursday October 24 2002 - 6:07:51 BST

Hi Kevin.

Thank you for this. I'll give it a shot and let you know what happens.


PS: Are there any developments going on that would allow me to build the menu items dynamically from a database using asp?