force my javascript to run after drawmenus

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
dhaack
Advanced
Advanced
Posts: 15
Joined: Thu Aug 05, 2004 8:01 am
Location: Chicago, US

force my javascript to run after drawmenus

Post by dhaack »

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
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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

Ruth
dhaack
Advanced
Advanced
Posts: 15
Joined: Thu Aug 05, 2004 8:01 am
Location: Chicago, US

Here is code I want to run

Post by dhaack »

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
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

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
dhaack
Advanced
Advanced
Posts: 15
Joined: Thu Aug 05, 2004 8:01 am
Location: Chicago, US

no luck

Post by dhaack »

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
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

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
dhaack
Advanced
Advanced
Posts: 15
Joined: Thu Aug 05, 2004 8:01 am
Location: Chicago, US

buildAllMenus

Post by dhaack »

Fixed problem, so if anybody else is having trouble

Works like a charm

Thanks for support

Dave
Post Reply