Calling other functions when i start and exit the menu

Please note that official support for this menu version has now ceased. There are still plenty of users, though, and the forum is still running. Some of our long-time users may be able to help you out.
Post Reply
chemicalX
Beginner
Beginner
Posts: 4
Joined: Thu Oct 17, 2002 12:00 pm
Location: Johannesburg, Gauteng, South Africa
Contact:

Calling other functions when i start and exit the menu

Post by chemicalX »

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?

Thanks.
cX
One day we'll all look back at this, laugh nervously, and change the subject...
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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,

Kevin
chemicalX
Beginner
Beginner
Posts: 4
Joined: Thu Oct 17, 2002 12:00 pm
Location: Johannesburg, Gauteng, South Africa
Contact:

Post by chemicalX »

Hi Kevin.

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

Thanks.
cX
One day we'll all look back at this, laugh nervously, and change the subject...
chemicalX
Beginner
Beginner
Posts: 4
Joined: Thu Oct 17, 2002 12:00 pm
Location: Johannesburg, Gauteng, South Africa
Contact:

Post by chemicalX »

Kevin, me again.

Okay, that didn't work :) heheh.

I tried what you suggested, and it looked like this

Code: Select all

  ,"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.
Johann.

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.
One day we'll all look back at this, laugh nervously, and change the subject...
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

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,

Code: Select all

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

Code: Select all

,"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:

Code: Select all

,"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.

Cheers,

Kevin
chemicalX
Beginner
Beginner
Posts: 4
Joined: Thu Oct 17, 2002 12:00 pm
Location: Johannesburg, Gauteng, South Africa
Contact:

Post by chemicalX »

Hi Kevin.

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

J.

PS: Are there any developments going on that would allow me to build the menu items dynamically from a database using asp?
One day we'll all look back at this, laugh nervously, and change the subject...
Post Reply