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

How to display a tree menu branch upon page load?


Poster: dlu
Dated: Tuesday November 1 2005 - 19:56:21 GMT

Hi,

I believe this question has been asked and answered many times, but I cannot seem to get it working.

What I want to do is that once the page is loaded, I want to expand "Finance" branch of a tree menu so that its submenus are displayed. Here is the section of the code.

[code]
with(new menuname("main Tree Menu")){
top=15
left=10
style = tstyle1;
alwaysvisible = 1;
itemwidth=200
//margin=AllMargin
position="relative"
aI("text=MILONIC;");
aI("text=Home;");
aI("text=News Too much too much too much too much word warp word wrap;showmenu=News;type=tree;");
aI("text=Finance;showmenu=Finance;type=tree;");
aI("text=Sports;showmenu=Sports;type=tree;");
aI("text=Entertainment;showmenu=Entertainment;type=tree;");
aI("text=Music;showmenu=Music;type=tree;");
aI("text=Games;");
aI("text=Relationships;");
aI("text=Travel;");
aI("text=Shopping;");
}

with(new menuname("News")){
style = sub1Style;
margin=AllMargin
aI("text=National;url=#");
aI("text=International;url=#");
aI("text=Technology;url=#");
aI("text=Politics;url=#");
aI("text=Campaign 2004;url=#");
aI("text=Health & Wellness;url=#");
}


with(new menuname("Finance")){
style = sub1Style;
margin=AllMargin
//alwaysvisible = 1;
aI("text=MILONIC;url=#");
aI("text=US Markets;showmenu=US Markets;type=tree;url=us_market.htm");
aI("text=Portfolio;url=#");
aI("text=Watch list;url=#");
aI("text=Price Alert;url=#");
aI("text=Sectors;url=#");
aI("text=Advanced Chart;url=#");
}

with(market=new menuname("US Markets")){
style = sub2Style;
margin=AllMargin
aI("text=Market Snapshot;url=#");
aI("text=Market Movers;url=#");
aI("text=Word on The Street;url=#");
aI("text=Gainers/Losers;url=#");
aI("text=Most Actives;url=#");
aI("text=News;url=#");
}

with(new menuname("Sports")){
style = sub1Style;
margin=AllMargin
aI("text=MLB;url=#");
aI("text=NBA;url=#");
aI("text=NFL;url=#");
aI("text=NHL;url=#");
aI("text=College Sports;url=#");
aI("text=Golf;url=#");
}


drawMenus()
alert(getMenuByName ("Finance"))
alert(gpos(gmobj("menu" + getMenuByName("Finance"))));
//spos(gmobj("menu" + getMenuByName("Finance")), 300, null, null, null);
menuDisplay(getMenuByName ("Finance"), 1);
_m[getMenuByName ("Finance")][7]=1
alert(gpos(gmobj("menu" + getMenuByName("Finance"))));
[/code]

I searched this site and found some suggestions. But I cannot get it to work. I can display the main menu, but cannot expand the branch. Is the sequence of function calls right? Did I miss anything?

Thanks


Poster: starmetheus
Dated: Tuesday November 1 2005 - 23:08:11 GMT

This capability was added in a fairly recent update to the treemenu.js.

The function you'd want to use would be:
openBranchByName("Finance");

Make sure you have the most recent treemenu, and it should work fine. If I'm remembering correctly, it was added back in September...so if you've downloaded it since then, you should already be ok.


Poster: dlu
Dated: Wednesday November 2 2005 - 15:46:48 GMT

Thanks, starmetheus. I downloaded the most recent one using the link at the bottom of "http://www.milonic.com/treemenu/" this morning, and it worked.

I guess we need to emphasize here "the most recent". I downloaded collapsible menu module and tree menu module from the above URL a couple of days ago assuming they contained the most recent treemenu.js. I was wrong. Those zip files should have been updated regularly.