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:16

Adding submenus on the fly when mouseover happens


Poster: tmakaro
Dated: Thursday February 2 2006 - 5:17:52 GMT

Hi, I have over 2000 menu items which is taking too long to load all at once. I have come up with a way of dynamically retrieving submenu data from the server using a hidden iframe.

I have also figured out (through the help of this forum) how to insert a submenu into the menu:

function test() {
with(milonic=new menuname("Samples")){
overflow="scroll";
style=menuStyle;
aI("text=World Map Sample;url=http://www.milonic.com/menusample92.php;")
aI("text=US Map Sample;url=http://www.milonic.com/menusample91.php;")
aI("text=Image Map Sample;url=http://www.milonic.com/menusample4.php;")
}
mm_createNewMenus();
}

My Question is how do I call my own function , such as the test() above, when I hover over a menu that should pop up a submenu? When the mouse pointer hovers over a menu, I need to call a function that checks to see if the submenu is loaded. If the submenu is not loaded, I need to retrieve it from the server, load it into the menu and then display it.

I am willing to share my retrieving js code to the community if anyone wants it. I just need a way of hooking it to the mouse over event.


Poster: Migru
Dated: Thursday February 2 2006 - 16:39:25 GMT

Hi

normally

onfunction=myfunction();

included in the aI string calls my own function. (mouse-on state) I´m using it. I´m not certain, if it works as expected in a string which pops up a submenu.

Michael


Poster: Ruth
Dated: Thursday February 2 2006 - 16:48:32 GMT

Hi,

Onfunction and offfunction should work in strings which call a showmenu for a submenu.

Ruth


Poster: tmakaro
Dated: Thursday February 2 2006 - 19:14:58 GMT

i'm so close! The onfunction works great but i'm unable to display the menu.

Here is my example:
https://internal.tscsoftware.com/public ... /index.htm
and a snippet of the source:
for some reason 'itemOn' is failing.



<script type="text/javascript">
var got_it = false;

// onfunction defined in menu_data.js
function collectData() {
if (got_it == true) return;
// TODO go to server and get the submenu
setTimeout('myCallback()',1);
}

function myCallback() {
// this function will be called by the loaded document in the iframe

// TODO replace this code block with the one that gets the data from the iframe
with(milonic=new menuname("Samples")){
overflow="scroll";
style=menuStyle;
aI("text=Plain Text Horizontal Style DHTML Menu Bar;url=http://www.milonic.com/menusample1.php;")
aI("text=Vertical Plain Text Menu;url=http://www.milonic.com/menusample2.php;")
aI("text=Start Button Menu;url=http://www.milonic.com/menusample69.php;")
aI("text=Tramline;url=http://www.milonic.com/menusample54.php;")

}

mm_createNewMenus();
got_it = true;
menuNumber = getMenuByName("Samples");
alert("menuNumber = "+menuNumber);
itemOn(menuNumber); // this fails!
alert("here3");
}


Poster: Ruth
Dated: Saturday February 4 2006 - 0:34:54 GMT

Hi,

I don't undertand what you mean. When I go to the page and mouseover menu samples I get an alert menuNumber = 6 Then when I click ok and mouseover the item again I get the submenu. So, what is supposed to happen?

Ruth


Poster: tmakaro
Dated: Saturday February 4 2006 - 0:46:49 GMT

I got it working. try this the following link. I can only have it here for a short time. Each sub-menu is loaded from the server. I will post my code later.

http://www.makaro.com:8080/nightly/milonic/index.htm


Poster: tmakaro
Dated: Saturday February 4 2006 - 0:50:17 GMT

oh, I forgot to mention, the submenus have only three options and are currently all the same. I have it hard coded on the server.

What the example shows is the web page retrieving the submenus from the server as required when the mouse is hovering over the parent.


Poster: Ruth
Dated: Saturday February 4 2006 - 1:14:27 GMT

Hi,

That's terrific. The menu loaded really fast and the submenus open pretty quickly, also. If you can post how you did that so others might be able to use it in similar circumstances, it would be greatly appreciated.

Ruth