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:51
Collapse menu and expand and hyperlinking on click
Poster: kevdog98
Dated: Tuesday October 17 2006 - 23:52:49 BST
Hi,
I can not get the collapse menu to allow me to use the showmen and the url calls at the same time. It works calling both in the regular DHTML menu but not in the tree menu. I have trired calling both, and it breaks the code. I have also tried to use the onfunction to call a url but that breaks it also. Is there away to make it do to thinks onclick? Please let me know, I can not think of a way. Any ideas? I really need to figure this one out as my bosses really want it to work this way.
P.S. Can you delete all my other posts as I have solved those issues. I can not delete my posts.
Thanks for all your help.
Kevin
Poster: Ruth
Dated: Wednesday October 18 2006 - 1:53:39 BST
Hi,
After a lot of searching here I found an example of openbranchby name thing.
In all that I found it was put on the page, I have no idea if you can put it in the data file.
So, on each page you'd add this at the bottom
Code:
<script type="text/javascript">
drawMenus();
openBranchByName("Adults");
</script>
drawMenus();
openBranchByName("Adults");
</script>
In this case I put in the Adults as the branch name but you'd put in the correct name to correspond with whatever branch should be opened.
Just as a suggestion, so that it is obvious about the opened branch, you might put in a different offcolor for the tree submenus from the sub3Style. As an example try this, though you may not like the color I tried to find one that was real visible but not harsh
sub3Style.offcolor="#d9ebf0";
Ruth
Poster: kevdog98
Dated: Wednesday October 18 2006 - 16:45:33 BST
Thanks for the reply, but I have played around with the openbranchbyname and I don't think it will achieve what I need to do. What I need to do is have a tree menu expand and have a url launched both on click. Like a have tried to do here:
Code:
aI("text=<b>Ministries</b>;url=ministries.asp?id=38;");
aI("text=<b>Adults</b>;showmenu=Adults;type=tree;");
aI("text=<b>Young Adults</b>;url=ministries.asp?id=362;");
aI("text=<b>University Students</b>;url=ministries.asp?id=408;");
aI("text=<b>Jr.& Sr. High</b>;url=ministries.asp?id=410;");
aI("text=<b>Children & Families</b>;showmenu=CFM;type=tree;url=ministries.asp?id=364;");
aI("text=<b>Music</b>;showmenu=Music;type=tree;");
}
aI("text=<b>Adults</b>;showmenu=Adults;type=tree;");
aI("text=<b>Young Adults</b>;url=ministries.asp?id=362;");
aI("text=<b>University Students</b>;url=ministries.asp?id=408;");
aI("text=<b>Jr.& Sr. High</b>;url=ministries.asp?id=410;");
aI("text=<b>Children & Families</b>;showmenu=CFM;type=tree;url=ministries.asp?id=364;");
aI("text=<b>Music</b>;showmenu=Music;type=tree;");
}
But when I try to add the showmenu and url to the Children & Families menu item it messes up the code the page. You can see what I mean here http://205.158.143.230/ministries.asp?id=38
Here is they full code of my collapse_data.js file:
Code:
var mm_rollOffText;
var mm_rollItem;
function mm_onText(rollOnText)
{
mm_rollItem = _itemRef;
mm_rollOffText = _mi[mm_rollItem][1];
_mi[mm_rollItem][1] = rollOnText;
BDMenu(_mi[mm_rollItem][0]);
itemOn(mm_rollItem);
}
function mm_offText()
{
_mi[mm_rollItem][1] = mm_rollOffText;
BDMenu(_mi[mm_rollItem][0]);
itemOff(mm_rollItem);
}
_scrollAmount=5 // Used for Netscape 4 scrolling
_scrollDelay=10 // Used for Netscape 4 scrolling
_menuCloseDelay=500 // The delay for menus to remain visible on mouse off
_menuOpenDelay=150 // The delay for opening menus on mouse over
_subOffsetTop=0; // Sub menu offset Top position
_subOffsetLeft=0; // Sub menu offset Left position
Goverfilter="Alpha(style=1,opacity=25,finishOpacity=100,startX=0,finishX=100,startY=100,finishY=0);Fade(duration=0.2);Shadow(color='#777777', Direction=135, Strength=5)"
Goverfilter="Fade(duration=0.2);Alpha(opacity=90);Shadow(color='#777777', Direction=135, Strength=5)"
Goutfilter="randomdissolve(duration=0.3)"
Goutfilter=""
Goverfilter=""
AllMargin=0
treeOffset=0; // Used to set the offset of sub menus
singleMasterMenu=true // Informs the system to only have one menu open at a time
with(tstyle1=new mm_style()){
offbgcolor = "#429491";
onbgcolor = "#357688";
offcolor="#FFFFFF";
oncolor="#FFFFFF";
pagecolor="#FFFFFF";
pageimage="arrow.gif";
imageposition="right";
bordercolor="black"
borderstyle="solid";
borderwidth=0;
fontsize="11px";
fontfamily="Trebuchet MS";
itemwidth=114;
itemheight=30;
rawcss="padding:2px 0px 2px 4px";
keepalive=true;
}
sub1Style=new copyOf(tstyle1)
sub1Style.offcolor = "#429491";
sub1Style.offbgcolor="#8EA2BB"
sub1Style.separatorcolor="#556E8C"
sub1Style.clickcolor="#429491"
sub2Style=new copyOf(tstyle1)
sub2Style.offcolor = "#000000";
sub2Style.offbgcolor="#D6DDE6"
sub2Style.separatorcolor="#8EA2BB"
tstyle1.onbgcolor = "#357688";
tstyle1.offbgcolor = "#429491";
sub3Style=new copyOf(tstyle1)
sub3Style.padding=4;
sub3Style.fontsize="10px";
sub3Style.fontweight="bold";
with(new menuname("main Tree Menu")){
top=190
left=0
style = tstyle1;
alwaysvisible = 1;
menuheight=30;
menuwidth=114;
margin=AllMargin
aI("text=<b>Ministries</b>;url=ministries.asp?id=38;");
aI("text=<b>Adults</b>;showmenu=Adults;type=tree;");
aI("text=<b>Young Adults</b>;url=ministries.asp?id=362;");
aI("text=<b>University Students</b>;url=ministries.asp?id=408;");
aI("text=<b>Jr.& Sr. High</b>;url=ministries.asp?id=410;");
aI("text=<b>Children & Families</b>;showmenu=CFM;type=tree;url=ministries.asp?id=364;");
aI("text=<b>Music</b>;showmenu=Music;type=tree;");
}
with(new menuname("Adults")){
style = sub3Style;
margin=AllMargin
position="absolute"
itemwidth=114;
itemheight=30;
aI("text=Adults;url=ministries.asp?id=316;");
aI("text=What's Happening;url=ministries.asp?id=320;");
aI("text=Class Schedule;url=ministries.asp?id=80;");
aI("text=Opportunities to Serve;url=ministries.asp?id=344;");
aI("text=Finding Community;url=ministries.asp?id=346;");
aI("text=Caring Ministries;url=ministries.asp?id=404;");
}
with(new menuname("CFM")){
style = sub3Style;
position="absolute"
itemwidth=114;
itemheight=30;
margin=AllMargin
aI("text=Children & Familes;url=ministries.asp?id=364;");
aI("text=Calendar of Events & Activities;url=ministries.asp?id=374;");
aI("text=Early Childhood;url=ministries.asp?id=366;");
aI("text=Elementary;url=ministries.asp?id=368;");
aI("text=Side-by-Side;url=ministries.asp?id=370;");
aI("text=Resources for Teachers & Caregivers;url=ministries.asp?id=372;");
aI("text=CFM Staff Directory;url=ministries.asp?id=372;");
}
with(new menuname("Music")){
style = sub3Style;
position="absolute"
itemwidth=114;
itemheight=30;
margin=AllMargin
aI("text=Music;url=ministries.asp?id=376;");
aI("text=Concert Schedule;url=ministries.asp?id=378;");
}
drawMenus()
var mm_rollItem;
function mm_onText(rollOnText)
{
mm_rollItem = _itemRef;
mm_rollOffText = _mi[mm_rollItem][1];
_mi[mm_rollItem][1] = rollOnText;
BDMenu(_mi[mm_rollItem][0]);
itemOn(mm_rollItem);
}
function mm_offText()
{
_mi[mm_rollItem][1] = mm_rollOffText;
BDMenu(_mi[mm_rollItem][0]);
itemOff(mm_rollItem);
}
_scrollAmount=5 // Used for Netscape 4 scrolling
_scrollDelay=10 // Used for Netscape 4 scrolling
_menuCloseDelay=500 // The delay for menus to remain visible on mouse off
_menuOpenDelay=150 // The delay for opening menus on mouse over
_subOffsetTop=0; // Sub menu offset Top position
_subOffsetLeft=0; // Sub menu offset Left position
Goverfilter="Alpha(style=1,opacity=25,finishOpacity=100,startX=0,finishX=100,startY=100,finishY=0);Fade(duration=0.2);Shadow(color='#777777', Direction=135, Strength=5)"
Goverfilter="Fade(duration=0.2);Alpha(opacity=90);Shadow(color='#777777', Direction=135, Strength=5)"
Goutfilter="randomdissolve(duration=0.3)"
Goutfilter=""
Goverfilter=""
AllMargin=0
treeOffset=0; // Used to set the offset of sub menus
singleMasterMenu=true // Informs the system to only have one menu open at a time
with(tstyle1=new mm_style()){
offbgcolor = "#429491";
onbgcolor = "#357688";
offcolor="#FFFFFF";
oncolor="#FFFFFF";
pagecolor="#FFFFFF";
pageimage="arrow.gif";
imageposition="right";
bordercolor="black"
borderstyle="solid";
borderwidth=0;
fontsize="11px";
fontfamily="Trebuchet MS";
itemwidth=114;
itemheight=30;
rawcss="padding:2px 0px 2px 4px";
keepalive=true;
}
sub1Style=new copyOf(tstyle1)
sub1Style.offcolor = "#429491";
sub1Style.offbgcolor="#8EA2BB"
sub1Style.separatorcolor="#556E8C"
sub1Style.clickcolor="#429491"
sub2Style=new copyOf(tstyle1)
sub2Style.offcolor = "#000000";
sub2Style.offbgcolor="#D6DDE6"
sub2Style.separatorcolor="#8EA2BB"
tstyle1.onbgcolor = "#357688";
tstyle1.offbgcolor = "#429491";
sub3Style=new copyOf(tstyle1)
sub3Style.padding=4;
sub3Style.fontsize="10px";
sub3Style.fontweight="bold";
with(new menuname("main Tree Menu")){
top=190
left=0
style = tstyle1;
alwaysvisible = 1;
menuheight=30;
menuwidth=114;
margin=AllMargin
aI("text=<b>Ministries</b>;url=ministries.asp?id=38;");
aI("text=<b>Adults</b>;showmenu=Adults;type=tree;");
aI("text=<b>Young Adults</b>;url=ministries.asp?id=362;");
aI("text=<b>University Students</b>;url=ministries.asp?id=408;");
aI("text=<b>Jr.& Sr. High</b>;url=ministries.asp?id=410;");
aI("text=<b>Children & Families</b>;showmenu=CFM;type=tree;url=ministries.asp?id=364;");
aI("text=<b>Music</b>;showmenu=Music;type=tree;");
}
with(new menuname("Adults")){
style = sub3Style;
margin=AllMargin
position="absolute"
itemwidth=114;
itemheight=30;
aI("text=Adults;url=ministries.asp?id=316;");
aI("text=What's Happening;url=ministries.asp?id=320;");
aI("text=Class Schedule;url=ministries.asp?id=80;");
aI("text=Opportunities to Serve;url=ministries.asp?id=344;");
aI("text=Finding Community;url=ministries.asp?id=346;");
aI("text=Caring Ministries;url=ministries.asp?id=404;");
}
with(new menuname("CFM")){
style = sub3Style;
position="absolute"
itemwidth=114;
itemheight=30;
margin=AllMargin
aI("text=Children & Familes;url=ministries.asp?id=364;");
aI("text=Calendar of Events & Activities;url=ministries.asp?id=374;");
aI("text=Early Childhood;url=ministries.asp?id=366;");
aI("text=Elementary;url=ministries.asp?id=368;");
aI("text=Side-by-Side;url=ministries.asp?id=370;");
aI("text=Resources for Teachers & Caregivers;url=ministries.asp?id=372;");
aI("text=CFM Staff Directory;url=ministries.asp?id=372;");
}
with(new menuname("Music")){
style = sub3Style;
position="absolute"
itemwidth=114;
itemheight=30;
margin=AllMargin
aI("text=Music;url=ministries.asp?id=376;");
aI("text=Concert Schedule;url=ministries.asp?id=378;");
}
drawMenus()
Thanks for all your help.
Kevin
Poster: Ruth
Dated: Wednesday October 18 2006 - 18:36:47 BST
Hi Kevin,
It's the openmenusbyurl.js and using the openbranchbyname together that is causing the top menu to disappear, I think. At least when I removed the openmenusbyurl and tested the top menu still shows and the treemenu branch was open. However, I don't know what's causing the image shift in the treemenu. I'll see what I can find out.
EDIT: I can't find any place that you have openbranchbyname on that page. But, in my test it works if I remove the openmenusbyurl.js module and add the openBranchByName on the destination test page.
Ruth
Poster: kevdog98
Dated: Wednesday October 18 2006 - 19:56:07 BST
Ok, I think I can make the openbranchbyname work if we can figure out why it buts the arrow on the left for those pages, instead of the right like it should.
Thanks for all your help,
Kevin
Poster: Ruth
Dated: Wednesday October 18 2006 - 20:17:34 BST
Yes, it will work as I said, after removing the openmenusbyurl.js module on the page where you're going. Change your main menu Adults aI to the following
Code:
aI("text=<b>Adults</b>;showmenu=Adults;url=ministries.asp?id=316;type=tree;");
Remove the following aI from the Adults submenu.
Code:
aI("text=Adults;url=ministries.asp?id=316;");
Then on that Adults page [id=316] remove the openmenusbyurl.js module and put this at the bottom just before the ending body tag
Code:
<script type="text/javascript">
drawMenus();
openBranchByName("Adults");
</script>
drawMenus();
openBranchByName("Adults");
</script>
Save it and test. It worked fine for me except for the pageimage problem which I have reported.
I have no idea about the openBranchByName and how to use it, I got the script calls from a few posts where they had used it and all of those had it on the page. As I said, I have no idea if you can put it in the data file somehow.
Ruth