»
EnglishFrenchVietnamese

Print - Show and hide hierarchical menu ondoubleclick - JavaScriptBank.com

Full version: jsB@nk » Menu » Right click menu » Show and hide hierarchical menu ondoubleclick
URL: https://www.javascriptbank.com/hierarchical-menu-ondoubleclick.html

Show and hide hierarchical menu ondoubleclick © JavaScriptBank.comThis is the first fullfledged hierarchical JavaScript menu that you can show and hide simply by doubleclicking. Works with IE4x as well as NN4.6x and higher.

Full version: jsB@nk » Menu » Right click menu » Show and hide hierarchical menu ondoubleclick
URL: https://www.javascriptbank.com/hierarchical-menu-ondoubleclick.html



CSS
<STYLE>A {COLOR: #ff0000}</STYLE><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<SCRIPT><!-- Beginning of JavaScript -// Hierarchical menu ondoubleclick// INSTRUCTIONS: // Copy the block <div id="menu"> at the end of the body-part of this webpage.// Paste this block at the end of the body-part of your webpage.// Do not change this block.// Put the the image minus131.gif and the image plus131.gif in the same directory// as the script.// Configure the menu and font parameters for each menublock below.// each menublock[x] contains all necessary informations to build one menu-item with // as many sublinks as you like. You can add as many menublocks as you need.// Attention: When you configure the menublocks take care that you// set the ";" and the "+" as seen below.var menublock=new Array() var plus_i=0 menublock[0]="Verdana;"+ // font mainlink "1;"+// fontsize mainlink "000000;"+// fontcolor mainlink "1;"+// fontweight mainlink, 1 means bold, 0 means normal "Verdana;"+ // font sublinks "1;"+// fontsize sublinks "FFFFFF;"+// fontcolor sublinks "0;"+// fontweight sublinks, 1 means bold, 0 means normal "Main link;|http://JavaScriptBank.com|;"+ // text|URL|target of mainlink "Link 1;|http://JavaScriptBank.com;"+// text|URL|target of first sublink "Link 2|http://JavaScriptBank.com;" // text|URL|target of second sublink menublock[1]="Verdana;"+ // font mainlink "1;"+// fontsize mainlink "000000;"+// fontcolor mainlink "1;"+// fontweight mainlink, 1 means bold, 0 means normal "Verdana;"+ // font sublinks "1;"+// fontsize sublinks "FFFFFF;"+// fontcolor sublinks "0;"+// fontweight sublinks, 1 means bold, 0 means normal "Main link;|http://JavaScriptBank.com|;"+ // text|URL|target of mainlink "Link 1;|http://JavaScriptBank.com;"+// text|URL|target of first sublink "Link 2|http://JavaScriptBank.com;" // text|URL|target of second sublink  menublock[2]="Verdana;"+     // font mainlink "1;"+// fontsize mainlink "000000;"+// fontcolor mainlink "1;"+// fontweight mainlink, 1 means bold, 0 means normal "Verdana;"+ // font sublinks "1;"+// fontsize sublinks "FFFFFF;"+// fontcolor sublinks "0;"+// fontweight sublinks, 1 means bold, 0 means normal "Main link;|http://JavaScriptBank.com|;"+ // text|URL|target of mainlink "Link 1;|http://JavaScriptBank.com;"+// text|URL|target of first sublink "Link 2|http://JavaScriptBank.com;" // text|URL|target of second sublink               // The following block is different. It contains a mainlink without submenus.// Take care to set the ";;;;" exactly as seen below.menublock[3]="Verdana;"+ // font mainlink "1;"+// fontsize mainlink "000000;"+// fontcolor mainlink             "1;"+// fontweight mainlink, 1 means bold, 0 means normal             ";;;;"+     // leave it empty "Main link;|http://JavaScriptBank.com|;"+ // text|URL|target of mainlink "Link 1;|http://JavaScriptBank.com;"+// text|URL|target of first sublink "Link 2|http://JavaScriptBank.com;" // text|URL|target of second sublink  // the backgroundcolor of the menu var bgmenu="FF0000"// the width of the menu (pixels)var widthmenu=150              // No need to change anything below //  **********************************************************************************  var menusplitvar urlsplitvar font_weight_mainvar font_weight_subvar font_weight_subvar showmenu=1var x,yvar minusimg=new Image()minusimg.src="s.gif"var plusimg=new Image()plusimg.src="s.gif" var showsubmenus=new Array()for (i=0;i<=menublock.length-1;i++) {showsubmenus[i]=-1}var plusminusimg=new Array()for (i=0;i<=menublock.length-1;i++) {plusminusimg[i]=plusimg.src}function openandclose(visi) {showsubmenus[visi]=(-1)*showsubmenus[visi]    var menucontent=""    if (showsubmenus[visi]==1) {plusminusimg[visi]=minusimg.src}    if (showsubmenus[visi]==-1) {plusminusimg[visi]=plusimg.src}    menucontent+="<table border=0 cellspacing=0  width="+widthmenu+">"for (i=0;i<=menublock.length-1;i++) {menusplit=menublock[i].split(";")urlsplit=menusplit[8].split("|")if (menusplit[3]==1) {font_weight_main="<b>"}if (menusplit[3]==0) {font_weight_main=""}if (menusplit[7]==1) {font_weight_sub="<b>"}if (menusplit[7]==0) {font_weight_sub=""} menucontent+="<tr><td bgcolor="+bgmenu+">"       if (menusplit[9].length==0) {            menucontent+="&nbsp;</td>"            menucontent+="<td bgcolor="+bgmenu+">"            menucontent+=font_weight_main            menucontent+="<a href="+urlsplit[1]+" target="+urlsplit[2]+">"            menucontent+="<font face="+menusplit[0]+" color="+menusplit[2]+" size="+menusplit[1]+">"            menucontent+=urlsplit[0]            menucontent+="</font></a></td></tr>"            plus_i++         }                if (menusplit[9].length!=0) {            var thismainmenu=i+plus_i            menucontent+="<a href='javascript:openandclose("+i+")'>"            menucontent+="&nbsp;&nbsp;<img src='"+plusminusimg[i]+"' border=0></a></td>"            menucontent+="<td bgcolor="+bgmenu+">"            menucontent+=font_weight_main            menucontent+="<a href='javascript:openandclose("+i+")'>"            menucontent+="<font face="+menusplit[0]+" color="+menusplit[2]+" size="+menusplit[1]+">"            menucontent+=urlsplit[0]            menucontent+="</font></a></td></tr>"       if (showsubmenus[i]==1) {    for (ii=9;ii<=menusplit.length-1;ii++) {    urlsplit=menusplit[ii].split("|")                    menucontent+="<tr><td bgcolor="+bgmenu+">&nbsp;</td><td bgcolor="+bgmenu+">"        menucontent+=font_weight_sub                    menucontent+="<a href="+urlsplit[1]+" target="+urlsplit[2]+">"                    menucontent+="<font face="+menusplit[4]+" color="+menusplit[6]+" size="+menusplit[5]+">"                    menucontent+=urlsplit[0]                    menucontent+="</font></a>&nbsp;</td></tr>"    }    }        }    }    menucontent+="</table>"if (document.all) {menu.innerHTML=menucontent}if (document.layers) {document.menu.document.write(menucontent)document.menu.document.close()}}function dblclick() {if (document.all && showmenu==1) {document.all.menu.style.visibility="visible"document.all.menu.style.posLeft=xdocument.all.menu.style.posTop=y}if (document.layers && showmenu==1) {document.menu.visibility="visible"document.menu.left=xdocument.menu.top=y}if (document.all && showmenu!=1) {document.all.menu.style.visibility="hidden"}if (document.layers && showmenu!=1) {document.menu.visibility="hidden"}showmenu=showmenu*-1}if (document.layers) {document.captureEvents(Event.ONDBLCLICK);}document.ondblclick=dblclick;if (document.layers){document.captureEvents(Event.MOUSEMOVE);}document.onmousemove = handlerMM;function handlerMM(e){x = (document.layers) ? e.pageX : event.clientXy = (document.layers) ? e.pageY : event.clientY}// - End of JavaScript - --></SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<BODY onload=openandclose(1000)><DIV id=menu style="LEFT: 10px; POSITION: absolute; TOP: 20px; VISIBILITY: hidden"></DIV></BODY><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


Files
http://javascriptbank.com/javascript/menu/s.gif