View Full Version : function mmLoadMenus()
sharey
06-23-2003, 11:57 PM
I have a MM function that was created by dreamweaver, and it creates a popup menu. On one of the links I would like to target a blank window(target="_blank"). But this doesnt work with the javascript that it creates. I thought I could use something like window.open(url.htm) but this doesnt work either. here is the function, and there is also a .js file that it references. It seems like all of that code in the .js file is just refering to the appearence of the menu so I am not including it. If you need it to give me a hand, by all means please ask. Im using DWmx.
<script language="JavaScript" type="text/JavaScript">function mmLoadMenus() {
if (window.mm_menu_0609161207_0) return;
window.mm_menu_0609161207_0 = new Menu("root",160,16,"Arial, Helvetica, sans-serif",10,"#FFFFFF","#FF6600","#336699","#FFFFFF","left","middle",3,0,300,-5,7,true,false,true,0,true,true);
mm_menu_0609161207_0.addMenuItem("Same_Day_Air","location='sameday_air.htm'");
mm_menu_0609161207_0.addMenuItem("Domestic_Airfreight","location='domestic_airfreight.htm'");
mm_menu_0609161207_0.addMenuItem("International_Courier / Airfreight","location='international_courier.htm'");
mm_menu_0609161207_0.hideOnMouseOut=true;
mm_menu_0609161207_0.bgColor='#555555';
mm_menu_0609161207_0.menuBorder=0;
mm_menu_0609161207_0.menuLiteBgColor='#FFFFFF';
mm_menu_0609161207_0.menuBorderBgColor='#6699CC';
mm_menu_0609164230_0.writeMenus();
}
</script>
Lets say that I want "sameday_air.htm" to launch in a seperate window.
sorry to dump a bunch of WYSIWYG code on you, but this is what I use.
Thanks a lot in advance to all those that respond!
Josh
sharey
06-24-2003, 12:55 AM
Does this make sence, or am I way off?
Thanks everyone for your time :)
shlagish
06-24-2003, 03:36 AM
I think we would need the .js file to do this
sharey
06-24-2003, 04:05 AM
Cool, here it is.
Thanks for taking a peek!
shlagish
06-24-2003, 04:50 AM
Just a wild shot in the dark:
In the .js file:
function addMenuItem(label, action, target) {
this.items[this.items.length] = label;
this.actions[this.actions.length] = action;
this.targets[this.targets.lenght] = target;
}
The, in the other file;
mm_menu_0609161207_0.addMenuItem("Same_Day_Air","location='sameday_air.htm'","_blank");
As I said, it's just a wild shot in the dark, I'm pretty sure it wont work, but you can play around with this method...
I'm not the best person to anawer you in here :s
sharey
06-24-2003, 03:23 PM
Thanks for the attemp, Unfortunatly this disabled the menu all together:( Anyone else....plz:confused:
Thanks for trying though!~
Josh
toplisek
02-04-2009, 11:57 AM
what is actually definition of 'sub1','subdiv1'?
I have 6 items and second item has 6 submenus.
code like:
<div class="menutitle" onclick="SwitchMenuNew('sub1','subdiv1')">
freedom_razor
02-04-2009, 01:56 PM
Post the link to your page please.
toplisek
02-04-2009, 02:03 PM
Sorry, I'm testing menu sample.
Please find my source code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="images/style.css" rel="stylesheet" />
<title>Nav-menu</title>
<script language="javascript" src="includes/functions.js">function mmLoadMenus() {
if (window.mm_menu_0823164715_0) return;
window.mm_menu_0823164715_0 = new Menu("root",59,18,"",12,"#000000","#FFFFFF","#FFFFFF","#000084","left","middle",3,0,1000,-5,7,true,false,true,0,true,true);
mm_menu_0823164715_0.addMenuItem("Item1","location='#'");
mm_menu_0823164715_0.addMenuItem("Item2","location='#'");
mm_menu_0823164715_0.addMenuItem("Item3","location='#'");
mm_menu_0823164715_0.addMenuItem("Item4","location='#'");
mm_menu_0823164715_0.hideOnMouseOut=true;
mm_menu_0823164715_0.bgColor='#555555';
mm_menu_0823164715_0.menuBorder=1;
mm_menu_0823164715_0.menuLiteBgColor='#FFFFFF';
mm_menu_0823164715_0.menuBorderBgColor='#777777';
mm_menu_0823164715_0.writeMenus();
} // mmLoadMenus()</script>
<script language="JavaScript" src="mm_menu.js"></script>
</head>
<body>
<!-- Left Panel Starts -->
<table width="299" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><!-- Keep all menus within masterdiv-->
<div id="masterdiv">
<div class="menutitle" onclick="SwitchMenuNew('sub1','subdiv1')">
<img src="images/button1.jpg" width="299" height="46" alt="" />
</div>
<span class="submenu" id="sub1"><a onmouseover="changeBG('sub1', 0);" onmouseout="changeBG('sub1', 1);" onclick="setValue('sub',1,3);" href="index1.html" class="linktext">Item1</a></span>
<div id="subdiv3" style="display:none"><table cellpadding="0" cellspacing="0" border="0" width="138" class="hr"><tr><td></td></tr></table></div>
<div class="menutitle" onclick="SwitchMenuNew('sub2,sub3,sub4,sub5,sub6,sub7', 'subdiv1,subdiv2,subdiv3,subdiv4,subdiv5,subdiv6,subdiv7')">
<img src="images/button2.jpg" width="299" height="30" alt="" />
</div>
<span class="submenu" id="sub2"><a onmouseover="changeBG('sub2', 0);" onmouseout="changeBG('sub2', 1);" onclick="setValue('sub',2,7);" href="index2.html" class="linktext">
<img src="images/button3.jpg" width="299" height="23" alt="" />
</a></span>
<div id="subdiv1" style="display:none"><table cellpadding="0" cellspacing="0" border="0" width="138" class="hr"><tr><td></td></tr></table></div>
<span class="submenu" id="sub3"><a onmouseover="changeBG('sub3', 0);" onmouseout="changeBG('sub3', 1);" onclick="setValue('sub',3,7);" href="index3.html" class="linktext">
<img src="images/button4.jpg" width="299" height="31" alt="" />
</a></span>
<span class="submenu" id="sub4"><a onmouseover="changeBG('sub4', 0);" onmouseout="changeBG('sub4', 1);" onclick="setValue('sub',4,7);" href="index3.html" class="linktext">
<img src="images/button3.jpg" width="299" height="23" alt="" />
</a></span>
<span class="submenu" id="sub5"><a onmouseover="changeBG('sub5', 0);" onmouseout="changeBG('sub5', 1);" onclick="setValue('sub',5,7);" href="index3.html" class="linktext">
<img src="images/button3.jpg" width="299" height="23" alt="" />
</a></span>
<span class="submenu" id="sub6"><a onmouseover="changeBG('sub6', 0);" onmouseout="changeBG('sub6', 1);" onclick="setValue('sub',6,7);" href="index3.html" class="linktext">
<img src="images/button3.jpg" width="299" height="23" alt="" />
</a></span>
<span class="submenu" id="sub7"><a onmouseover="changeBG('sub7', 0);" onmouseout="changeBG('sub7', 1);" onclick="setValue('sub',7,7);" href="index3.html" class="linktext">
<img src="images/button3.jpg" width="299" height="23" alt="" />
</a></span>
<div id="subdiv2" style="display:none"><table cellpadding="0" cellspacing="0" border="0" width="138" class="hr"><tr><td></td></tr></table></div>
<div class="menutitle" onclick="SwitchMenuNew('sub8','subdiv1')">
<img src="images/button7.jpg" width="299" height="30" alt="" />
</div>
<span class="submenu" id="sub8"><a onmouseover="changeBG('sub8', 0);" onmouseout="changeBG('sub8', 1);" onclick="setValue('sub',3,0);" href="index1.html" class="linktext">Item8</a></span>
<div id="subdiv8" style="display:none"><table cellpadding="0" cellspacing="0" border="0" width="138" class="hr"><tr><td></td></tr></table></div>
<div class="menutitle" onclick="SwitchMenuNew('sub9','subdiv1')">
<img src="images/button8.jpg" width="299" height="30" alt="" />
</div>
<span class="submenu" id="sub9"><a onmouseover="changeBG('sub9', 0);" onmouseout="changeBG('sub9', 1);" onclick="setValue('sub',3,0);" href="index1.html" class="linktext">Item9</a></span>
<div id="subdiv9" style="display:none"><table cellpadding="0" cellspacing="0" border="0" width="138" class="hr"><tr><td></td></tr></table></div>
<div class="menutitle" onclick="SwitchMenuNew('sub10','subdiv1')">
<img src="images/button9.jpg" width="299" height="30" alt="" />
</div>
<span class="submenu" id="sub10"><a onmouseover="changeBG('sub10', 0);" onmouseout="changeBG('sub10', 1);" onclick="setValue('sub',3,0);" href="index1.html" class="linktext">Item10</a></span>
<div id="subdiv10" style="display:none"><table cellpadding="0" cellspacing="0" border="0" width="138" class="hr"><tr><td></td></tr></table></div>
<div class="menutitle" onclick="SwitchMenuNew('sub11','subdiv1')">
<img src="images/button10.jpg" width="299" height="30" alt="" />
</div>
<span class="submenu" id="sub11"><a onmouseover="changeBG('sub11', 0);" onmouseout="changeBG('sub11', 1);" onclick="setValue('sub',3,0);" href="index1.html" class="linktext">Item11</a></span>
<div id="subdiv11" style="display:none"><table cellpadding="0" cellspacing="0" border="0" width="138" class="hr"><tr><td></td></tr></table></div>
<div class="menutitle" onclick="SwitchMenuNew('sub12','subdiv1')">
<img src="images/button11.jpg" width="299" height="30" alt="" />
</div>
<span class="submenu" id="sub12"><a onmouseover="changeBG('sub12', 0);" onmouseout="changeBG('sub12', 1);" onclick="setValue('sub',3,0);" href="index1.html" class="linktext">Item11</a></span>
<div id="subdiv12" style="display:none"><table cellpadding="0" cellspacing="0" border="0" width="138" class="hr"><tr><td></td></tr></table></div>
</div>
</td>
</tr>
</table>
<!-- Menus Ends -->
</body>
</html>
I would like to have consistent code to open tree menu.
some buttons should not have any sub menu and do not know if this is completely ok. I have added for main menu buttons increased ID values like id="sub12". But would like to have without submenu item in some samples.
kash007
02-24-2009, 11:25 AM
I would be very oblige of you guy if some body can help me wiht folowing,
1. changing resoluton of the screen move menu location
2. I want to put image instead of color on mouseover in menu.
Please help mw how to do so.
this is my code
function mmLoadMenus() {
if (window.m1_1) return;
window.m1_1 = new Menu( "Funding by Departments",180,16,"Verdana, Arial, Helvetica, sans-serif",10,"#31597B","#ffffff","#E7EFFF","#31597B","left","middle",3,0,200,5,7,true,true,true,0,true,true);
//200, // width of menu item
//20, // height of menu item
//"Arial, Helvetica, sans-serif", // font
//10, // font size
//"#808285", // text color no mouse over
//"#4ca76c", // text color mouse over
//"#ffffff", // menu item bgcolor no mouse over
//"#f2f3f9", // menu item bgcolor mouse over
//"left", // horizontal text alignment
//"middle", // vertical text alignment
//3, // indent
//0, // cellspacing
//200, // timeout in ms
//2, // x-pos submenu
//0, // y-pos submenu
//true,
//true, // opacity of item separators
//true,
//0,
//false,
//true);
m1_1.fontWeight="bold";
m1_1.hideOnMouseOut=true;
m1_1.menuBorder=1;
m1_1.menuLiteBgColor='#ffffff';
m1_1.menuBorderBgColor='#b3b3b3';
m1_1.bgColor='#b3b3b3';
m1_1.addMenuItem
toplisek
02-24-2009, 11:48 AM
Hi freedom_razor,
can see my code and maybe you can help?
Thank you
freedom_razor
02-24-2009, 12:06 PM
If you don't have it up on the net, why don't you zip all the relevant files [.js and .css] and attach them so we can take a look. Just your HTML code is not enough.
toplisek
02-24-2009, 12:22 PM
Hi, now problem. Please see sample (button and images are just as sample).
Q:
what is actually definition of 'sub1','subdiv1'?
I have 6 items and second item has 6 submenus.
code like:
<div class="menutitle" onclick="SwitchMenuNew('sub1','subdiv1')">
freedom_razor
02-24-2009, 01:43 PM
'sub1' etc. are IDs of SPANs in your menu code - each SPAN is one position of the open menu - contains the link:
MENUTITLE
-SPAN 'sub1' with link
-DIV 'subdiv1' with empty TABLE
MENUTITLE
-SPAN 'sub2' with link
-DIV 'subdiv2' with empty TABLE
-SPAN 'sub3' with link
-DIV 'subdiv3' with empty TABLE
'subdiv1' etc. are IDs of the DIV that's under each SPAN tag, I don't know what for it is there. In your code you have them all filled with empty tables with class="hr" - which makes me think [can't know for sure since you didn't attach your CSS file] they're being used as horizontal lines :confused:
toplisek
02-24-2009, 02:58 PM
So, I can I remove or how to add class for buttons to control style?
Is possible to control style of links by class="linktext"?
Have question how to remove correctly last item and its link. It should be without link when clicked. name of button is:
See all TOP ten lists
freedom_razor
02-24-2009, 03:07 PM
About adding and removing classes to tags you should read some tutorials on the web. It is possible to control style of links using class="linktext". Just use Google (http://www.google.es/search?q=css+tutorial).
To remove items you just need to erase them and remove references to them from function calls. To remove links, the same, just remove links. Your menu works on SPAN tags, what's included in SPAN isn't important for functioning of the script, so you can have links, text or whatever there.
toplisek
02-24-2009, 03:15 PM
Hi, sorry, I'm new to this tree menu.
If I have:
<div class="menutitle" onclick="SwitchMenuNew('sub12','subdiv1')">
<img src="images/button11.jpg" width="299" height="30" alt="" />
</div>
<span class="submenu" id="sub12"><a onmouseover="changeBG('sub12','subdiv1');" onmouseout="changeBG('sub12', 1);" onclick="setValue('sub',3,0);" href="index1.html" class="linktext">Item12</a></span>
<div id="subdiv12" style="display:none"><table cellpadding="0" cellspacing="0" border="0" width="138" class="hr"><tr><td></td></tr></table></div>
How to remove correctly Item12 that will work only link on main button (last button with number 7) not opened submenu with link Item12?
freedom_razor
02-24-2009, 04:08 PM
<div class="menutitle">
<img src="images/button11.jpg" width="299" height="30" alt="" />
</div>
Try the above, though be aware that I'm not sure what you're asking for. Can't see any button number 7 in that code.
toplisek
02-24-2009, 09:18 PM
Buttons are actually this what you click in the start (not sub menu).
I mean 7 button as last clicked area.
Is ths ok to add simply tag like:
<a href="cdcdsc"> <img src="images/button11.jpg" width="299" height="30" alt="" /> </a>
freedom_razor
02-24-2009, 11:33 PM
Just remove whole onclick="..." from there, that way it won't open any submenu. And yes, if you want that button image to be a link to somewhere, your code's ok for that.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.