»
EnglishFrenchVietnamese

Print - Menu Close Script - JavaScriptBank.com

Full version: jsB@nk » Menu » Multilevel menu » Menu Close Script
URL: http://www.javascriptbank.com/menu-close-script.html

Menu Close Script © JavaScriptBank.comThis is a multilevel-menu script.

Full version: jsB@nk » Menu » Multilevel menu » Menu Close Script
URL: http://www.javascriptbank.com/menu-close-script.html



CSS
<STYLE type=text/css>.goldlink {FONT-WEIGHT: bold; FONT-SIZE: 12pt; TEXT-DECORATION: none}.menutext {FONT-SIZE: 10pt; TEXT-DECORATION: none}</STYLE><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<SCRIPT language=JavaScript><!--// Menu Close Script version 1.0//  by Woody Walton - 2001// The CheckLayers() function captures the onMouseMove event (for both IE and NN)//   and begins checking to see if the mouse has mopved out of the menu area//   using the getMouseLocation() function://function checkLayers(){ if (window.Event)    document.captureEvents(Event.MOUSEMOVE);   document.onmousemove = getMouseLocation; }// The getMouseLocation() function takes the event passed from checkLayers(e),//    initializes two variables for the x and y position of the mouse,//    checks for which event model (IE or NN) being used, assigns the mouse's//    current x and y position to the variables, and checks to see if the mouse //    is tsill within the menu area.  If the mouse is outside of the box, the//    hideLayers() function is called.  To customize this part, you will need //    to supply your own coordinates for the greater than and less than values.//function getMouseLocation(e) {  var xPos = "";  var yPos = "";  if(document.layers) {      xPos = e.pageX;      yPos = e.pageY;  } else {      xPos = event.clientX + document.body.scrollLeft;      yPos = event.clientY + document.body.scrollTop;  }  if(yPos < 20 || yPos > 145 || xPos < 25 || xPos > 340) {     hideLayers();     }}// The hideLayers() function just calls the Dreamweaver-generated function to //    hide the layers from view, then it calls the stopCheck() function.  Be//    careful not to hide the link layers so that your menus can be used more//    than once!//function hideLayers() {  MM_showHideLayers('menu1sub1link1','','hide','menu1sub1link2','','hide','menu1sub1link3','','hide','menu1sub2link2','','hide','menu1sub2link1','','hide','menu1sub1','','hide','menu1sub2','','hide');  stopCheck(); }// The stopCheck() function releases the onMouseMove Event so that you don't have//    a script constantly looking for the mouse's movement!//function stopCheck(){   if(window.Event)    document.releaseEvents(Event.MOUSEMOVE);    document.onmousemove = null;}// The following are Dreamweaver-generated scripts for showing/hiding layers//function MM_findObj(n, d) { //v3.0  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); return x;}function MM_showHideLayers() { //v3.0  var i,p,v,obj,args=MM_showHideLayers.arguments;  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }    obj.visibility=v; }}// The rest of this file is style sheet info to spruce up the menu displays and several layers//    which can be either text or images (or whatever).  I hope you enjoy using this script!//--></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<DIV id=menu1sub1link1hi style="Z-INDEX: 27; LEFT: 24px; VISIBILITY: hidden; WIDTH: 193px; POSITION: absolute; TOP: 43px; HEIGHT: 30px"><TABLE width=191 bgColor=#99ff99 border=1>  <TBODY>  <TR>    <TD><FONT face="Arial, Helvetica, sans-serif" color=#336633 size=2><B       class=menutext>Menu 1 Sub 1 Link 1</B></FONT></TD></TR></TBODY></TABLE></DIV><DIV id=menu1sub1link2hi style="Z-INDEX: 29; LEFT: 24px; VISIBILITY: hidden; WIDTH: 193px; POSITION: absolute; TOP: 65px; HEIGHT: 32px"><TABLE width=191 bgColor=#99ff99 border=1>  <TBODY>  <TR>    <TD height=21><FONT face="Arial, Helvetica, sans-serif" color=#336633       size=2><B class=menutext>Menu 1 Sub 1 Link 2</B></FONT></TD></TR></TBODY></TABLE></DIV><DIV id=menu1sub1link3hi style="Z-INDEX: 31; LEFT: 24px; VISIBILITY: hidden; WIDTH: 193px; POSITION: absolute; TOP: 87px; HEIGHT: 29px"><TABLE width=191 bgColor=#99ff99 border=1>  <TBODY>  <TR>    <TD><FONT face="Arial, Helvetica, sans-serif" color=#336633 size=2><B       class=menutext>Menu 1 Sub 1 Link 3... &nbsp;&gt;&gt;   </B></FONT></TD></TR></TBODY></TABLE></DIV><DIV id=menu1sub1link1 style="Z-INDEX: 28; LEFT: 25px; VISIBILITY: hidden; WIDTH: 188px; POSITION: absolute; TOP: 45px; HEIGHT: 18px"><A onmouseover="MM_showHideLayers('menu1sub1link1hi','','show','menu1sub2link2','','hide','menu1sub2link1','','hide','menu1sub2','','hide')" onfocus=if(this.blur)this.blur() onclick="stopCheck();MM_showHideLayers('menu1sub1link1','','hide','menu1sub1link2','','hide','menu1sub1link3','','hide','menu1sub2link2','','hide','menu1sub2link1','','hide','menu1sub1','','hide','menu1sub2','','hide')" onmouseout="MM_showHideLayers('menu1sub1link1hi','','hide')" href="http://JavaScriptBank.com"><IMG height=21 src="shim.gif" width=151 border=0></A></DIV><DIV id=menu1sub1link2 style="Z-INDEX: 30; LEFT: 26px; VISIBILITY: hidden; WIDTH: 188px; POSITION: absolute; TOP: 70px; HEIGHT: 18px"><A onmouseover="MM_showHideLayers('menu1sub1link2hi','','show','menu1sub2link2','','hide','menu1sub2link1','','hide','menu1sub2','','hide')" onfocus=if(this.blur)this.blur() onclick="stopCheck();MM_showHideLayers('menu1sub1link1','','hide','menu1sub1link2','','hide','menu1sub1link3','','hide','menu1sub2link2','','hide','menu1sub2link1','','hide','menu1sub1','','hide','menu1sub2','','hide')" onmouseout="MM_showHideLayers('menu1sub1link2hi','','hide')" href="javascript:newWin('sacc_history.htm')"><IMG height=21 src="shim.gif" width=142 border=0></A></DIV><DIV id=menu1sub1link3 style="Z-INDEX: 32; LEFT: 27px; VISIBILITY: hidden; WIDTH: 188px; POSITION: absolute; TOP: 93px; HEIGHT: 18px"><A onmouseover="MM_showHideLayers('menu1sub1link3hi','','show','menu1sub2link2','','show','menu1sub2link1','','show','menu1sub2','','show')" onfocus=if(this.blur)this.blur() onmouseout="MM_showHideLayers('menu1sub1link3hi','','hide')" href="http://JavaScriptBank.com"><IMG height=21 src="shim.gif" width=151 border=0></A></DIV><DIV id=menu1sub2link1hi style="Z-INDEX: 41; LEFT: 196px; VISIBILITY: hidden; WIDTH: 193px; POSITION: absolute; TOP: 87px; HEIGHT: 29px"><TABLE width=191 bgColor=#99ff99 border=1>  <TBODY>  <TR>    <TD><FONT face="Arial, Helvetica, sans-serif" color=#336633 size=2><B       class=menutext>Menu 1 Sub 2 Link 1</B></FONT></TD></TR></TBODY></TABLE></DIV><DIV id=menu1sub2link2hi style="Z-INDEX: 43; LEFT: 196px; VISIBILITY: hidden; WIDTH: 193px; POSITION: absolute; TOP: 109px; HEIGHT: 32px"><TABLE width=191 bgColor=#99ff99 border=1>  <TBODY>  <TR>    <TD height=21><FONT face="Arial, Helvetica, sans-serif" color=#336633       size=2><B class=menutext>Menu 1 Sub 2 Link 2</B></FONT></TD></TR></TBODY></TABLE></DIV><DIV id=menu1sub2link2 style="Z-INDEX: 44; LEFT: 196px; VISIBILITY: hidden; WIDTH: 188px; POSITION: absolute; TOP: 113px; HEIGHT: 18px"><A onmouseover="MM_showHideLayers('menu1sub2link2hi','','show')" onfocus=if(this.blur)this.blur() onclick="stopCheck();MM_showHideLayers('menu1sub1link1','','hide','menu1sub1link2','','hide','menu1sub1link3','','hide','menu1sub2link2','','hide','menu1sub2link1','','hide','menu1sub1','','hide','menu1sub2','','hide')" onmouseout="MM_showHideLayers('menu1sub2link2hi','','hide')" href="http://JavaScriptBank.com"><IMG height=21 src="shim.gif" width=148 border=0></A></DIV><DIV id=menu1sub2link1 style="Z-INDEX: 42; LEFT: 199px; VISIBILITY: hidden; WIDTH: 188px; POSITION: absolute; TOP: 88px; HEIGHT: 18px"><A onmouseover="MM_showHideLayers('menu1sub2link1hi','','show')" onfocus=if(this.blur)this.blur() onclick="stopCheck();MM_showHideLayers('menu1sub1link1','','hide','menu1sub1link2','','hide','menu1sub1link3','','hide','menu1sub2link2','','hide','menu1sub2link1','','hide','menu1sub1','','hide','menu1sub2','','hide')" onmouseout="MM_showHideLayers('menu1sub2link1hi','','hide')" href="http://JavaScriptBank.com"><IMG height=21 src="shim.gif" width=126 border=0></A></DIV><DIV id=menu1green style="Z-INDEX: 21; LEFT: 29px; VISIBILITY: hidden; WIDTH: 109px; POSITION: absolute; TOP: 23px; HEIGHT: 23px"><FONT class=goldlink face="Arial, Helvetica, sans-serif" color=#00ff00 size=2>Menu 1</FONT></DIV><DIV id=menu1gold style="Z-INDEX: 20; LEFT: 29px; VISIBILITY: visible; WIDTH: 169px; POSITION: absolute; TOP: 23px; HEIGHT: 23px"><FONT class=goldlink face="Arial, Helvetica, sans-serif" color=#ffcc00 size=2>Menu 1 </FONT>&nbsp;&nbsp;&nbsp;<FONT class=goldlink face="Arial, Helvetica, sans-serif" color=#00ff00 size=2>|</FONT>&nbsp;&nbsp;&nbsp;<FONT class=goldlink face="Arial, Helvetica, sans-serif" color=#ffcc00 size=2>Menu 2</FONT></DIV><DIV id=menu2green style="Z-INDEX: 24; LEFT: 116px; VISIBILITY: hidden; WIDTH: 122px; POSITION: absolute; TOP: 23px; HEIGHT: 22px"><P><FONT class=goldlink face="Arial, Helvetica, sans-serif" color=#00ff00 size=2>Menu 2 </FONT></P></DIV><DIV id=aboutlink style="Z-INDEX: 22; LEFT: 28px; VISIBILITY: visible; WIDTH: 63px; POSITION: absolute; TOP: 24px; HEIGHT: 18px"><A onmouseover="MM_showHideLayers('menu1sub1link1','','show','menu1sub1link2','','show','menu1sub1link3','','show','menu1sub2link2','','hide','menu1sub2link1','','hide','menu1green','','show','menu1sub1','','show','menu1sub2','','hide');checkLayers()" onfocus=if(this.blur)this.blur() onmouseout="MM_showHideLayers('menu1green','','hide')" href="http://JavaScriptBank.com"><IMG height=16 src="shim.gif" width=63 border=0></A></DIV><DIV id=menu2link style="Z-INDEX: 25; LEFT: 116px; VISIBILITY: visible; WIDTH: 71px; POSITION: absolute; TOP: 25px; HEIGHT: 18px"><A onmouseover="MM_showHideLayers('menu1sub1link1','','hide','menu1sub1link2','','hide','menu1sub1link3','','hide','menu1sub2link2','','hide','menu1sub2link1','','hide','menu2green','','show','menu1sub1','','hide','menu1sub2','','hide')" onfocus=if(this.blur)this.blur() onclick="MM_showHideLayers('bigsacc','','hide','AffiliatesLayer','','show','OutFront','','hide')" onmouseout="MM_showHideLayers('menu2green','','hide')" href="http://JavaScriptBank.com"><IMG height=19 src="shim.gif" width=58 border=0></A></DIV><DIV id=menu1sub1 style="Z-INDEX: 26; LEFT: 24px; VISIBILITY: hidden; WIDTH: 193px; POSITION: absolute; TOP: 43px; HEIGHT: 74px"><TABLE width=191 bgColor=#ffffcc border=1>  <TBODY>  <TR>    <TD><FONT face="Arial, Helvetica, sans-serif" color=#336633 size=2><B       class=menutext>Menu 1 Sub 1 Link 1</B></FONT></TD></TR>  <TR>    <TD><FONT face="Arial, Helvetica, sans-serif" color=#336633 size=2><B       class=menutext>Menu 1 Sub 1 Link 2</B></FONT></TD></TR>  <TR>    <TD><FONT face="Arial, Helvetica, sans-serif" color=#336633 size=2><B       class=menutext>Menu 1 Sub 1 Link 3... &nbsp;&gt;&gt;   </B></FONT></TD></TR></TBODY></TABLE></DIV><DIV id=menu1sub2 style="Z-INDEX: 40; LEFT: 196px; VISIBILITY: hidden; WIDTH: 193px; POSITION: absolute; TOP: 87px; HEIGHT: 53px"><TABLE width=191 bgColor=#ffffcc border=1>  <TBODY>  <TR>    <TD><FONT face="Arial, Helvetica, sans-serif" color=#336633 size=2><B       class=menutext>Menu 1 Sub 2 Link 1</B></FONT></TD></TR>  <TR>    <TD><FONT face="Arial, Helvetica, sans-serif" color=#336633 size=2><B       class=menutext>Menu 1 Sub 2 Link 2</B></FONT></TD></TR></TBODY></TABLE></DIV><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->