Multiple Menus / Dynamic

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
dmcquade
Advanced
Advanced
Posts: 15
Joined: Fri Oct 27, 2006 6:26 pm

Multiple Menus / Dynamic

Post by dmcquade »

Hello everyone,

I have a page that shows multiple menus that are *almost* identical. They all have the same options, but the links vary slightly.

Right now I have a variable passed to the menudata.asp file, but I've been told that I'm basically creating a new menu instance for each menu and I should instead use a single menu and change the values dynamically.

Has anyone had any experience with this? I'm not great with JavaScript, so I'm struggling with how to make the menu items dynamic so I can have 10 different menus driven from the same menu block.

DJ
dmcquade
Advanced
Advanced
Posts: 15
Joined: Fri Oct 27, 2006 6:26 pm

Post by dmcquade »

If anyone can give me a hand with this, I would really appreciate it. Even a link to a site would be very helpful. I've looked around and I can't seem to find a good method to do this.

Thanks! :)

DJ
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Hi,

If you've got something we can work with I'll see if I can create a demo for you.

The old link login details don't work anymore.

Cheers,
Andy
dmcquade
Advanced
Advanced
Posts: 15
Joined: Fri Oct 27, 2006 6:26 pm

Post by dmcquade »

I would really appreciate it!

I had to remove the old test username and password because bad people were doing bad things. If you can email me, I'll reply with the login information.

Thanks!!!

DJ
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Hi,

I decided that AJAX was going to make things too complicated for this particular project. So, what I did was create something that only needs 3 menu objects and the contents of these 3 objects will change depending on which bottle you are currently hovering over.

This should also be easy to integrate with what you already have.

Here's the code in its entirety.........


Code: Select all

<html>
<body>

<script type="text/javascript" src="http://milonic.com/milonic_src.js"></script>	
<script type="text/javascript" src="http://milonic.com/mmenudom.js"></script>
<script type="text/javascript" src="http://milonic.com/mm_menueditapi.js"></script>


<script>
	
	
	
	
fixMozillaZIndex=true; //Fixes Z-Index problem  with Mozilla browsers but causes odd scrolling problem, toggle to see if it helps
_menuCloseDelay=200;
_menuOpenDelay=100;
_subOffsetTop=2;
_subOffsetLeft=-2;

with(menuStyle=new mm_style()){
bordercolor="#296488";
borderstyle="solid";
borderwidth=1;
fontfamily="Verdana, Tahoma, Arial";
fontsize="75%";
fontstyle="normal";
headerbgcolor="#ffffff";
headercolor="#000000";
offbgcolor="#DCE9F0";
offcolor="#515151";
onbgcolor="#4F8EB6";
oncolor="#ffffff";
outfilter="randomdissolve(duration=0.3)";
overfilter="Fade(duration=0.2);Alpha(opacity=90);Shadow(color=#777777', Direction=135, Strength=5)";
padding=5;
pagebgcolor="#82B6D7";
pagecolor="black";
separatorcolor="#2D729D";
separatorsize=1;
subimage="arrow.gif";
subimagepadding=2;
}


with(milonic=new menuname("WinePopupFullList")){
style=menuStyle;
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
}


with(milonic=new menuname("WinePopupFullListConsumed")){
style=menuStyle;
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
}

with(milonic=new menuname("WinePopupFullListNotReceived")){
style=menuStyle;
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
aI("text=Dummy Item");
}

drawMenus();

	

function trim(str){
   return str.replace(/^\s*|\s*$/g,"");
}	
	
function valueFromQueryString(qS,prop)
{	
	var tempArray
	tempArray=qS.split(";")

	for(var x=0;x<tempArray.length;x++){
		var qsA=tempArray[x].split("=")
		qsA[0]=trim(qsA[0])
		if(qsA[0]==prop)return qsA[1];

	}
	return 0;	
}	
	
	
	function customPopup(t,queryString){
		bottleid=valueFromQueryString(queryString,"bottleid");
		wvid=valueFromQueryString(queryString,"wvid");
		
		var menuReference=getMenuByName("WinePopupFullList");
		mm_editItem(menuReference,0,"text=Edit;url=edit_wine.asp?bottle_id="+bottleid+";",1);
		mm_editItem(menuReference,1,"text=Move Bottle;url=move_wine_select_rack.asp?bottle_id="+bottleid+";",1);
		mm_editItem(menuReference,2,"text=Add Same;url=add_wine_step_3.asp?wvid="+wvid+";",1);
		mm_editItem(menuReference,3,"text=Delete;url=my_cellar.asp?action=delete&bottle_id="+bottleid+"&wvid="+wvid+";",1);
		mm_editItem(menuReference,4,"text=Ratings / Info;url=wine_info.asp?wvid="+wvid+";",1);
		mm_editItem(menuReference,5,"text=Google;url=http://www.google.com/search?q=Test Vineyards Cabernet Sauvignon 2003;target=_new;",1);
		mm_editItem(menuReference,6,"text=Wine Labels;url=upload_wine_label.asp?wvid="+wvid+";",1);
		mm_editItem(menuReference,7,"text=Consume;url=consume.asp?bottle_id="+bottleid+";",1);
		mm_editItem(menuReference,8,"text=Consume & Review;url=consume_and_review.asp?bottle_id="+bottleid+"&wvid="+wvid+"&review_id=0;",1);

		var menuReference=getMenuByName("WinePopupFullListConsumed");
		mm_editItem(menuReference,0,"text=Edit;url=edit_wine.asp?bottle_id="+bottleid+";",1);
		mm_editItem(menuReference,1,"text=Move Bottle;url=move_wine_select_rack.asp?bottle_id="+bottleid+";",1);
		mm_editItem(menuReference,2,"text=Add Same;url=add_wine_step_3.asp?wvid="+wvid+";",1);
		mm_editItem(menuReference,3,"text=Delete;url=my_cellar.asp?action=delete&bottle_id="+bottleid+"&wvid="+wvid+";",1);
		mm_editItem(menuReference,4,"text=Ratings / Info;url=wine_info.asp?wvid="+wvid+";",1);
		mm_editItem(menuReference,5,"text=Google;url=http://www.google.com/search?q=Test Vineyards Cabernet Sauvignon 2003;target=_new;",1);
		mm_editItem(menuReference,6,"text=Wine Labels;url=upload_wine_label.asp?wvid="+wvid+";",1);
		mm_editItem(menuReference,7,"text=Undo Drink;url=my_cellar.asp?action=undo_drink&bottle_id="+bottleid+";",1);
				
		var menuReference=getMenuByName("WinePopupFullListNotReceived");
		mm_editItem(menuReference,0,"text=Edit;url=edit_wine.asp?bottle_id="+bottleid+";",1);
		mm_editItem(menuReference,1,"text=Move Bottle;url=move_wine_select_rack.asp?bottle_id="+bottleid+";",1);
		mm_editItem(menuReference,2,"text=Add Same;url=add_wine_step_3.asp?wvid="+wvid+";",1);
		mm_editItem(menuReference,3,"text=Delete;url=my_cellar.asp?action=delete&bottle_id="+bottleid+"&wvid="+wvid+";",1);
		mm_editItem(menuReference,4,"text=Ratings / Info;url=wine_info.asp?wvid="+wvid+";",1);
		mm_editItem(menuReference,5,"text=Google;url=http://www.google.com/search?q=Test Vineyards Cabernet Sauvignon 2003;target=_new;",1);
		mm_editItem(menuReference,6,"text=Wine Labels;url=upload_wine_label.asp?wvid="+wvid+";",1);
		mm_editItem(menuReference,7,"text=Mark Received;url=my_cellar.asp?action=markreceived&place=no&bottle_shock=no&bottle_id="+bottleid+";",1);
		mm_editItem(menuReference,8,"text=Mark Received w/Bottle Shock;url=my_cellar.asp?action=markreceived&place=no&bottle_shock=yes&bottle_id="+bottleid+";",1);
		mm_editItem(menuReference,9,"text=Mark Received & Place;url=my_cellar.asp?action=markreceived&place=yes&bottle_shock=no&bottle_id="+bottleid+";",1);
		mm_editItem(menuReference,10,"text=Mark Received & Place w/Bottle Shock;url=my_cellar.asp?action=markreceived&place=yes&bottle_shock=yes&bottle_id="+bottleid+";",1);

		popup("WinePopupFullList",1)
	}
	
	</script>
		
	
<a id=andy href=# onmouseover="customPopup(this,'wvid=1129;bottleid=1519')" onmouseout=popdown()>Bottle 1</a><BR>
<a id=andy href=# onmouseover="customPopup(this,'wvid=1571;bottleid=1520')" onmouseout=popdown()>Bottle 2</a><BR>
<a id=andy href=# onmouseover="customPopup(this,'wvid=1850;bottleid=1521')" onmouseout=popdown()>Bottle 3</a><BR>
<a id=andy href=# onmouseover="customPopup(this,'wvid=2058;bottleid=1522')" onmouseout=popdown()>Bottle 4</a><BR>
<a id=andy href=# onmouseover="customPopup(this,'wvid=4;bottleid=1523')" onmouseout=popdown()>Bottle 5</a><BR>
<a id=andy href=# onmouseover="customPopup(this,'wvid=489;bottleid=1524')" onmouseout=popdown()>Bottle 6</a><BR>
<a id=andy href=# onmouseover="customPopup(this,'wvid=8;bottleid=1525')" onmouseout=popdown()>Bottle 7</a><BR>
<a id=andy href=# onmouseover="customPopup(this,'wvid=197;bottleid=1526')" onmouseout=popdown()>Bottle 8</a><BR>
<a id=andy href=# onmouseover="customPopup(this,'wvid=1570;bottleid=1527')" onmouseout=popdown()>Bottle 9</a><BR>	
	
	<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<a href="http://websites.milonic.com/milonic.com/>JavaScript Menu Powered by Milonic</a>
	
	
</body>
</html>


All you should need to do is copy the above code and paste it into a new .html document and then run the document in your browser.

Hope this helps,
Andy
Post Reply