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:11
Newbie menu / submenu with openmenubyurl question
Poster: Juree
Dated: Monday March 13 2006 - 15:20:44 GMT
Hello -
Sorry to bother with this *newbie* question, but I am unable to get the examples I've seen here on the forum and in the examples area to work for me. Hoping someone here can look at my code and point me in the right direction...
My sample is located at: http://www.juree.com/estateworks/index.asp
Click on the 'Solutions' link. This takes you to the solutions/overview.asp page.
I now have a vertical menu, with vertical submenus. When you click a menu title, the submenu should appear. If I put a link on the menu title (click on 'Solutions' and it reloads the solutions/overview.asp page) then the submenu never appears. If I don't put a link on the menu title (for example, the 'News & Events' link, then the submenu appears.)
I would like a couple of things to happen here when you click a menu title:
1) The corresponding page loads (if any)
2) The submenu expands
3) The selected menu title is highlighted
If you click a submenu title then I would like:
1) The corresponding page loads
2) the submenu stays expanded
3) The selected submenu title is highlighted
I have downloaded and put in the file link for the openmenubyurl.js, but I'm obviously missing something vital here, as I cannot get it to work. I don't get any javascript error messages, so I believe that the files are found - I just need to correct the settings to get things to fly.
Any assistance you can offer would be great! Thanks in advance...
Juree
Poster: Migru
Dated: Tuesday March 14 2006 - 0:37:26 GMT
Hi
what should basically be modified before you go into details is that
the files / references
Code:
<SCRIPT language=JavaScript src="../milonic_src.js" type=text/javascript></SCRIPT>
<script language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=../mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=../mmenudom.js><\/scr"+"ipt>");
</script>
<SCRIPT language=JavaScript src="../includes/tree/treemenu.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="../includes/tree/collapse_data.js" type=text/javascript></SCRIPT>
<script type="text/javascript" src="../includes/tree/openmenubyurl.js"></script>
</script>
<script type="text/javascript" src="menu_data.js"></script>
<script language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=../mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=../mmenudom.js><\/scr"+"ipt>");
</script>
<SCRIPT language=JavaScript src="../includes/tree/treemenu.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="../includes/tree/collapse_data.js" type=text/javascript></SCRIPT>
<script type="text/javascript" src="../includes/tree/openmenubyurl.js"></script>
</script>
<script type="text/javascript" src="menu_data.js"></script>
should not be placed in a <td> cell. that is definitely not recomended.
Michael
Please see http://www.milonic.com/tablemenu.php
Poster: Juree
Dated: Tuesday March 14 2006 - 2:37:31 GMT
Hi Michael,
Thanks for the post. I've updated the pages to include the cross-browser code for this implementation. I should be all set with that now.
However, I still have the issue of understanding what in the code I need to modify to get the desired behavior. Now that I have the code implemented correctly within the table cell, do you have any pointers on how to get it to behave the way I want?
Thanks for the assistance!
Juree
Poster: Migru
Dated: Tuesday March 14 2006 - 7:37:30 GMT
Hi
Sorry for a mistake, I think we have to go one step back
You have followed the instructions for a "normal" vertical menu. Here we have the collaps- menu, so please put it together (the main back into the datafile and then:
<td><SCRIPT language=JavaScript src="../includes/collapse_data.js" type=text/javascript></SCRIPT></td>
Settings in this file:
right after the global settings on top (they start with an _underscore)
set
retainClickValue = true;
Will see if this helps
Michael
Works like a charm
Poster: Juree
Dated: Wednesday March 15 2006 - 0:53:18 GMT
Thanks for the assistance!
With your help I got started in the right direction. With a little more time I was able to identify the code I needed to make this work. For those of you out there that would like to take a peek, here is the data file that I'm using:
Code:
_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=20; // Sub menu offset Top position
_subOffsetLeft=-170; // Sub menu offset Left position
retainClickValue = true; //Used to force the menu to stay expanded
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=5;
treeOffset=10; // Used to set the offset of sub menus
singleMasterMenu=true // Informs the system to on;y have one menu open at a time
with(tstyle1=new mm_style()){
offcolor = "#ffffff";
onbgcolor = "#B1C0DB";
oncolor = "#ffffff";
offbgcolor="#6182B8"
ondecoration="none"
borderwidth=0
padding = 2
fontsize = "110%";
fontfamily="Tahoma, Verdana, Arial";
fontweight="bold";
subimageposition="top right" ;
separatorsize=0
subimagepadding=3
imagepadding=2
itemwidth=170
}
sub1Style=new copyOf(tstyle1)
sub1Style.offcolor = "#ffffff";
sub1Style.clickcolor="#009"; //dictates the color of selected submenu item
sub1Style.pagecolor = "#fff";//dictates the color of selected page
sub1Style.pagebgcolor ="#2ABF00";//dictates the bg color of selected page
tstyle1.offcolor="#ffffff";
tstyle1.clickcolor="#009";
with(new menuname("main Tree Menu")){
position="relative";
style = tstyle1;
alwaysvisible = 1;
itemwidth=170
aI("text=Home;url=../estateworks/index.asp;");
aI("text=Solutions;showmenu=Solutions;type=tree;");
aI("text=Products & Services;showmenu=Products;type=tree;");
aI("text=News & Events;showmenu=News;type=tree;");
}
with(new menuname("Solutions")){
style = sub1Style;
aI("status=Overview;text=Overview;url=../estateworks/solutions/Overview.asp;");
aI("status=Law Firm Solutions;text=Law Firms;url=../estateworks/solutions/LawFirms.asp;");
aI("status=Financial Institutions Solutions;text=Financial Institutions;url=../estateworks/solutions/Financial.asp;");
}
with(new menuname("Products")){
style = sub1Style;
aI("text=Product1;url=products.asp");
aI("text=Product2;url=#");
}
with(new menuname("News")){
style = sub1Style;
aI("text=Press Releases;url=news.asp");
aI("text=Events;url=#");
}
On my pages (for example solutions/overview.asp) I added the the functions to highlight the clicked menu item and selected page to finish out the functionality:
Code:
openBranchByName("Solutions"); //Open the Solutions submenu
mmItemActivateByText('Overview'); //Highlight the Overview listing
Works like a charm! Thanks again!