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

force my javascript to run after drawmenus


Poster: dhaack
Dated: Saturday August 7 2004 - 1:11:58 BST

I want my code to run after menus are displayed; but no matter where I put code, seems to run before drawmenus.

Tried body onload; seperate <script></script> at end of body.

Please any help would be useful

Thanks Dave


Poster: Ruth
Dated: Saturday August 7 2004 - 4:52:29 BST

Not my area, but you might say just what code you want to run after the drawMenu.

Ruth

Here is code I want to run


Poster: dhaack
Dated: Saturday August 7 2004 - 6:19:06 BST

function getcookiemenu(mainmenu) {
var cookie = getcookie(mainmenu);
comma1 = cookie.indexOf(",",0);
comma2 = cookie.indexOf(",",comma1+1);
comma3 = cookie.indexOf(",",comma2+1);
comma4 = cookie.indexOf(",",comma3+1);
menuinfo = cookie.substr(0,comma1);
toppos = cookie.substr(comma1+1,comma2-comma1-1);
left = cookie.substr(comma2+1,comma3-comma2-1);
height = cookie.substr(comma3+1,comma4-comma3-1);
width = cookie.substr(comma4+1,cookie.length);
if (toppos != "")
{
menuNumber = getMenuByName(menuinfo);
spos(gmobj("menu" + menuNumber),toppos,left,null,null);
popup(menuinfo);
}
return
}

Routine calls cookie that stores last position and menu used; sets position using spos and then calls popup.

Problem is runs before drawmenus so does not display detail data


Poster: Ruth
Dated: Saturday August 7 2004 - 7:57:46 BST

Again, this isn't anything I really understand, but I have this vague memory, and it may not really have been about a function, but I think it was, and I think someone said something about trying it as the last thing in the menu_data.js file after the drawMenus();

Ruth

no luck


Poster: dhaack
Dated: Saturday August 7 2004 - 8:40:52 BST

I have tried that already and no luck. Problem is internal functions of Milonic have onload when I look at the programs.

Need way to force drawmenus() to completely load onload, then run my script.

Thanks for trying

Dave


Poster: Andy
Dated: Monday August 9 2004 - 10:15:07 BST

Hi,

For the record, the menu does not use document.onload at all. This is free for your use. The onload's that you are seeing in the code is for some images as we need to know the size etc.

Anyway, the problem might be due to the fact that the sub menus are not built at loadtime. They are only built when needed. If you want to build them all at loadtime you could add buildAllMenus=true; to the top of your menu_data.js file.

Basically, there are a number of reason why your code isn't running in the correct place. Seeing a URL will help alot so that I can run a few testes and see what is happening.

Cheers
Andy

buildAllMenus


Poster: dhaack
Dated: Monday August 9 2004 - 17:45:50 BST

Fixed problem, so if anybody else is having trouble

Works like a charm

Thanks for support

Dave