Waseem Abbas Waseem Abbas - 4 months ago 9
jQuery Question

JS Menu Dropdown not working live

Here is my code below, it is something that I got from my client and it is on very old versions. For now he want to run it straight away so I can't go for new menu.

Menu is working on local but not working live.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="global.css" type="text/css">
<title>Swano Textile | Home Page</title>
<script language="JavaScript" type="text/JavaScript">function mmLoadMenus() {
if (window.mm_menu_0304202013_0) return;
window.mm_menu_0304202013_0 = new Menu("root",128,22,"Arial, Helvetica, sans-serif",12,"#000000","#000000","#A1DBFF","#C1FC42","left","middle",6,0,1000,-5,7,true,true,true,0,true,true);
mm_menu_0304202013_0.addMenuItem("Company Profile","window.open('profile.htm', '_parent');");
mm_menu_0304202013_0.hideOnMouseOut=true;
mm_menu_0304202013_0.bgColor='#555555';
mm_menu_0304202013_0.menuBorder=1;
mm_menu_0304202013_0.menuLiteBgColor='#FFFFFF';
mm_menu_0304202013_0.menuBorderBgColor='#FFFFFF';

window.mm_menu_0304202701_0 = new Menu("root",170,24,"Arial, Helvetica, sans-serif",12,"#000000","#000000","#A1DBFF","#C1FC42","left","middle",6,0,1000,-5,7,true,true,true,0,true,true);
mm_menu_0304202701_0.addMenuItem("Washing&nbsp;Plant","window.open('washingplant.htm', '_parent');");
mm_menu_0304202701_0.addMenuItem("Cutting&nbsp;Department","window.open('cuttingdept.htm', '_parent');");
mm_menu_0304202701_0.addMenuItem("Stitching&nbsp;Department","window.open('stitchingdept.htm', '_parent');");
mm_menu_0304202701_0.addMenuItem("Finishing&nbsp;Department","window.open('finishingdept.htm', '_parent');");
mm_menu_0304202701_0.addMenuItem("Embroidery&nbsp;Department","window.open('embroiderydept.htm', '_parent');");
mm_menu_0304202701_0.hideOnMouseOut=true;
mm_menu_0304202701_0.bgColor='#555555';
mm_menu_0304202701_0.menuBorder=1;
mm_menu_0304202701_0.menuLiteBgColor='#FFFFFF';
mm_menu_0304202701_0.menuBorderBgColor='#FFFFFF';

mm_menu_0304202701_0.writeMenus();
} // mmLoadMenus()
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<script language="JavaScript" src="mm_menu.js"></script>
</head>

<body background="images/bg.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="MM_preloadImages('images/but1_ove.gif','images/but2_ove.gif','images/but3_ove.gif','images/but4_ove.gif','images/but5_ove.gif','images/designedby_ove.gif')">
<script language="JavaScript1.2">mmLoadMenus();</script>
<table class="tableborder" align="center" width="779" border="0" cellspacing="0" cellpadding="0">

<tr>
<td align="left" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/but_bg.gif">
<tr align="left" valign="top">
<td bgcolor="#314349"><img src="images/spacer.gif" width="1" height="39"></td>
<td><a href="index.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image11','','images/but1_ove.gif',1)"><img src="images/but1.gif" alt="Home" name="Image11" width="108" height="39" border="0"></a></td>
<td><img src="images/but_spacer.gif" width="2" height="39"></td>
<td><a href="#" onMouseOut="MM_swapImgRestore();MM_startTimeout();" onMouseOver="MM_swapImage('Image12','','images/but2_ove.gif',1);MM_showMenu(window.mm_menu_0304202013_0,-2,39,null,'Image12')"><img src="images/but2.gif" name="Image12" width="107" height="39" border="1"></a></td>
<td><img src="images/but_spacer.gif" width="2" height="39"></td>
<td><a href="#" onMouseOut="MM_swapImgRestore();MM_startTimeout();" onMouseOver="MM_swapImage('Image13','','images/but3_ove.gif',1);MM_showMenu(window.mm_menu_0304202701_0,0,39,null,'Image13')"><img src="images/but3.gif" name="Image13" width="109" height="39" border="0"></a></td>
<td><img src="images/but_spacer.gif" width="2" height="39"></td>
<td><a href="production.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image14','','images/but4_ove.gif',1)"><img src="images/but4.gif" name="Image14" width="127" height="39" border="0"></a></td>
<td><img src="images/but_spacer.gif" width="2" height="39"></td>
<td><a href="contact.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image15','','images/but5_ove.gif',1)"><img src="images/but5.gif" name="Image15" width="109" height="39" border="0"></a></td>
<td><img src="images/but_spacer.gif" width="2" height="39"></td>
<td><img src="images/spacer.gif" width="206" height="1"></td>
</tr>
</table></td>
</tr>

</table>
</body>
</html>

Answer

It will if you add mm_menu.js before using its function like,

<script language="JavaScript" src="mm_menu.js"></script>
<script>
   //your javascript menu  code
</script>

Updated your mm_menu.js gives error use

<script src="http://whowillbethenextonline.com/mm_examples/mm_menu.js"></script>

You tried to minify mm_menu.js but you missed some semicolons, etc

You can use JS Compiler to minify your js

Demo

Comments