»
Tiếng AnhTiếng PhápTiếng Việt

In - Menu nhiều cấp khi nhấn chuột - JavaScriptBank.com

Phiên bản đầy đủ: jsB@nk » Trình đơn » Trình đơn nhiều cấp » Menu nhiều cấp khi nhấn chuột
URL: https://www.javascriptbank.com/new-hierarchical-menu.html

Menu nhiều cấp khi nhấn chuột © JavaScriptBank.comĐoạn mã này tạo một trình đơn nhiều cấp với giao diện giản đơn. Mỗi khi người dùng nhấn chuột vào trình đơn được chỉ định thì các trình đơn con sẽ d9u7o75chie63n thị tương ứng.

Phiên bản đầy đủ: jsB@nk » Trình đơn » Trình đơn nhiều cấp » Menu nhiều cấp khi nhấn chuột
URL: https://www.javascriptbank.com/new-hierarchical-menu.html



CSS
<STYLE>A {TEXT-DECORATION: none}A:active {TEXT-DECORATION: none}A:visited {TEXT-DECORATION: none}A:hover {BACKGROUND-COLOR: #666666; 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><!-- Beginning of JavaScript -// new hierarchical menu//  **********************************************************************************// INSTRUCTIONS: // 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() // no need to change thismenublock[0]="Arial;"+ // font mainlink "4;"+// fontsize mainlink "000000;"+// fontcolor mainlink "1;"+// fontweight mainlink, 1 means bold, 0 means normal "Arial;"+ // font sublinks "2;"+// fontsize sublinks "000000;"+// fontcolor sublinks "0;"+// fontweight sublinks, 1 means bold, 0 means normal "MENU 1|#|;"+ // text|URL|target of mainlink "submenu 1.1|subm11.html|main;"+// text|URL|target of first sublink "submenu 1.2|subm12.html|main;" // text|URL|target of second sublink  menublock[1]="Arial;"+ // font mainlink "4;"+// fontsize mainlink "000000;"+// fontcolor mainlink "1;"+// fontweight mainlink, 1 means bold, 0 means normal "Arial;"+ // font sublinks "2;"+// fontsize sublinks "000000;"+// fontcolor sublinks "0;"+// fontweight sublinks, 1 means bold, 0 means normal "MENU 2|#;"+// text and URL of first mainlink "submenu 2.1|subm21.html|main;"+// text|URL|target of mainlink "submenu 2.2|subm22.html|main;"+// text|URL|target of first sublink "submenu 2.3|subm23.html|main;"+// text|URL|target of second sublink  "submenu 2.4|subm24.html|main;"+// text|URL|target of thirth sublink  "submenu 2.5|subm25.html|main;"// text|URL|target of fourth sublink  menublock[2]="Arial;"+ // font mainlink "4;"+// fontsize mainlink "000000;"+// fontcolor mainlink "1;"+// fontweight mainlink, 1 means bold, 0 means normal "Arial;"+ // font sublinks "2;"+// fontsize sublinks "000000;"+// fontcolor sublinks "0;"+// fontweight sublinks, 1 means bold, 0 means normal "MENU 3|#;"+// text and URL of mainlink "submenu 3.1|subm31.html|main;"+// text and URL of first sublink "submenu 3.2|subm32.html|main;"+// text and URL of second sublink "submenu 3.3|subm33.html|main;"// text and URL of thirth sublink  // No need to change anything below //  ********************************************************************************** var menusplitvar urlsplitvar font_weight_mainvar font_weight_sub var showsubmenus=new Array()for (i=0;i<=menublock.length-1;i++) {showsubmenus[i]=-1}function openandclose(visi) {showsubmenus[visi]=(-1)*showsubmenus[visi]var menucontent=""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+=font_weight_main+"<a href='javascript:openandclose("+i+")'><font face="+menusplit[0]+" color="+menusplit[2]+" size="+menusplit[1]+">"+urlsplit[0]+"</font></a><br>"if (showsubmenus[i]==1) {for (ii=9;ii<=menusplit.length-1;ii++) {urlsplit=menusplit[ii].split("|")    menucontent+=font_weight_sub+"&nbsp;&nbsp;&nbsp;<a href="+urlsplit[1]+" target="+urlsplit[2]+"><font face="+menusplit[4]+" color="+menusplit[6]+" size="+menusplit[5]+">"+urlsplit[0]+"</font></a><br>"}}}if (document.all) {menu.innerHTML=menucontent}if (document.layers) {document.menu.document.write(menucontent)document.menu.document.close()}}// - 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(10000)><DIV id=menu style="LEFT: 30px; POSITION: relative; TOP: 20px"></DIV></BODY><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->