Javascript drop-down menu (1)

Source: Internet
Author: User

// JavaScript document
// --------------- Main navigation bar content ------------//
VaR mainlayer = new array ("home", "About Us", "our service", "news", "online service", "online quote", "customer ", "link Info", "Contact Us", "employee ");
VaR mainlayerimg = new array (
New array (" "),
New array (" "),
New array (" "),
New array (" "),
New array (" "),
New array (" "),
New array (" "),
New array (" "),
New array (" "),
New array (" ")
);
VaR mainlayerhttp = new array ("index. JSP "," about. JSP "," # "," News. JSP "," http: // 220.228.203.222: 8099/VMI/index. JSP "," # "," cu. JSP ","#");
VaR mainlayertarget = new array ("", "_ blank ","","","","","");
VaR mainlayeronmouseover = new array (
New array ("mm_swapimage ('image3 ','', 'images/button_blue_01.gif', 1 )"),
New array ("mm_swapimage ('image4 ','', 'images/button_blue_02.gif', 1 )"),
New array ("mm_swapimage ('image5','', 'images/button_blue_03.gif ', 1 )"),
New array ("mm_swapimage ('image6 ','', 'images/button_blue_04.gif', 1 )"),
New array ("mm_swapimage ('image7 ','', 'images/button_blue_05.gif', 1 )"),
New array ("mm_swapimage ('image12','', 'images/online Quote-blue.GIF ', 1 )"),
New array ("mm_swapimage ('image8','', 'images/button_blue_06.gif ', 1 )"),
New array ("mm_swapimage ('image9','', 'images/button_blue_07.gif ', 1 )"),
New array ("mm_swapimage ('image10','', 'images/button_blue_08.gif ', 1 )"),
New array ("mm_swapimage ('image11','', 'images/Employee-blue.GIF ', 1 )")
);
VaR maintabletdwidth = new array (126,122,102, 63,102,102 );

// --------------- Content of the secondary navigation bar ------------//
VaR sublayer0 = new array ();
VaR sublayerhttp0 = new array ();
VaR sublayertarget0 = new array ();
VaR sublayer1 = new array ();
VaR sublayerhttp1 = new array ();
VaR sublayertarget1 = new array ();
VaR sublayer2 = new array ("Air export", "Air import", "sea freight", "domestic", "Logistics", "Hub ");
VaR sublayerhttp2 = new array (
New array ("SOS. jsp? Part = airexport "),
New array ("SOS. jsp? Part = airimport "),
New array ("SOS. jsp? Part = seafreight "),
New array ("SOS. jsp? Part = domestic "),
New array ("SOS. jsp? Part = Logistics "),
New array ("SOS. jsp? Part = Hub ")
);
VaR sublayertarget2 = new array ();
VaR sublayer3 = new array ();
VaR sublayerhttp3 = new array ();
VaR sublayertarget3 = new array ();
VaR sublayer4 = new array ();
VaR sublayerhttp4 = new array ();
VaR sublayertarget4 = new array ();
VaR sublayer5 = new array ();
VaR sublayerhttp5 = new array ();
VaR sublayertarget5 = new array ();
VaR sublayer6 = new array ("VMI", "tracking ");
VaR sublayerhttp6 = new array ("http: // 220.228.203.222: 8099/VMI/login.htm", "http://www.lsphub.com/symaton_top/tracking.jsp ");
VaR sublayertarget6 = new array ("_ blank", "_ blank ");
VaR sublayer7 = new array ();
VaR sublayerhttp7 = new array ();
VaR sublayertarget7 = new array ();
VaR sublayer8 = new array ("Taipei", "Taichung", "Tainan", "Kaohsiung", "Hongkong", "Fuzhou", "Xiamen", "Guangzhou ", "Shanghai", "Quanzhou", "Toronto ");
VaR sublayerhttp8 = new array ();
For (VAR I = 0; I <sublayer8.length; I ++ ){
Sublayerhttp8 [I] = "cu. jsp? Part = "+ encodeuricomponent (sublayer8 [I]);
}
VaR sublayertarget8 = new array ();
VaR sublayer9 = new array ("opinion", "Bulletin ");
VaR sublayerhttp9 = new array ("#","#");
VaR sublayertarget9 = new array ();
// --------------- Adjust the table parameters of the main navigation bar ------------//
// Var maintabletdwidth = 100; // adjust the content spacing of the main navigation bar based on the width of each TD.
VaR maintableborder = 0; // adjust the Border width of the main navigation table
VaR maintablecellspacing = 0; // adjust the main navigation table cellspacing
VaR maintablecellpadding = 0; // adjust the main navigation table cellpadding
VaR maintablebgcolor = "#000000"; // adjust the background color of the main navigation table
VaR maintablebordercolor = ""; // adjust the color of the main navigation table editing box.
VaR maintablebackgroundimg = ""; // adjust the URL of the background image of the main navigation table
VaR maintablehrefclassname = "Link" // adjust the URL Style
VaR maintabletdbgcolor = "#999999"; // adjust the TD color of the main navigation table

// --------------- Adjust the parameters of the secondary navigation bar table ------------//
VaR subtableborder = 0; // adjust the Border width of the subnavigation bar table
VaR subtablecellspacing = 0; // adjust the subnavigation bar table cellspacing
VaR subtablecellpadding = 1; // adjust the next navigation bar table cellpadding
VaR subtablebgcolor = "#000000"; // adjust the background color of the secondary navigation bar table
VaR subtablebordercolor = ""; // the color of the widget in the navigation bar.
VaR subtablebackgroundimg = ""; // URL of the background image of the navigation bar table
VaR subtabletdbgcolor = "# cccccc"; // adjust the TD color of the secondary navigation table.
VaR subtabletop = 30; // click it to fine-tune up and down the navigation table
VaR subtableleft =-1; // fine-tune left and right navigation tables
VaR subtablehrefclassname = "L-gray-12-03 ";

// --------------- System parameter * do not adjust ------------//
VaR layermax = mainlayer. Length + 10;
VaR layername = "Index ";

// --------------- Generate the drop-down menu ------------//
Function createmainlayer (){
Document. write ("<Table border = 0 cellspacing = 0 cellpadding = 0> <tr> <TD> <Div id = 'wall' onmouseout = layervib ('visable ', '"+ layermax +"') style = 'position: relative; left: 0px; top: 0px; width: 100%; Z-index: 1'> <Table width = "+ mainlayer. length * maintabletdwidth + "border = '" + maintableborder + "'cellspacing ='" + maintablecellpadding + "'cellpadding = '" + maintablecellpadding + "'bgcolor =" + maintablebgcolor +" 'bordercolor = '"+ maintablebordercolor +" 'background =' "+ maintablebackgroundimg +" '> <tr> ");
For (I = 0; I <mainlayer. length; I ++ ){
Document. write ("<TD nowrap width = '" + maintabletdwidth [I] + "'bgcolor ='" + maintabletdbgcolor + "'class = '" + maintablehrefclassname + "'onmouseover = layervib ('visible ', '"+ I +"')> <a href = '"+ mainlayerhttp [I] +" 'target =' "+ mainlayertarget [I] +" 'onmouseout = \ "mm_swapimgrestore () \ "onmouseover = \" "+ mainlayeronmouseover [I] +" \ "Title = \" "+ mainlayer [I] +" \ ">" + mainlayerimg [I] + "< /A> </TD> ");
}
Document. Write ("</tr> </table> ");

For (j = 0; j <mainlayer. length; j ++ ){
Createsublayer (j );
}
Document. Write ("</div> </TD> </tr> </table> ");
}

// --------------- Generate the content of each drop-down menu ------------//
Function createsublayer (Num ){
VaR sublayername = layername + num;
VaR sublayerlefttotal = 0;
For (var j = 0; j <num; j ++ ){
Sublayerlefttotal + = maintabletdwidth [J];
}
VaR sublayerleft = sublayerlefttotal + maintablecellpadding + maintableborder;
VaR sublayerlist = eval ("sublayer" + num );
VaR sublayerhttplist = eval ("sublayerhttp" + num );
VaR sublayertargetlist = eval ("sublayertarget" + num );
VaR target;
Document. write ("<Div id = '" + sublayername + "'style = 'position: absolute; left:" + (sublayerleft + subtableleft) + "PX; top: "+ (maintableborder + maintablecellspacing + maintablecellpadding) * 2 + subtabletop) +" PX; Z-index: 2; Height: 24px; visibility: hidden 'onmouseover = layervib ('visable', '"+ num +"') onmouseout = layervib ('visable', '"+ layermax +"')> ");
If (sublayerlist. length! = 0 ){
Document. write ("<Table width = '" + maintabletdwidth [num] + "'border ='" + subtableborder + "'cellspacing = '" + subtablecellpadding + "'cellpadding ='" + subtablecellpadding + "'bgcolor = '" + subtablebgcolor + "'bordercolor ='" + subtablebordercolor + "'background = '" + subtablebackgroundimg + "'")
For (H = 0; H <sublayerlist. length; H ++ ){
Target = sublayertargetlist [H];
Target = target = NULL? "_ Self": target;
Document. write ("<tr> <TD bgcolor = '" + subtabletdbgcolor + "'width = '000000' class = 'link' align = 'left' onmouseover = 'this. bgcolor = \ "# 3399ff \" 'onmouseout = 'this. bgcolor = \ "" + subtabletdbgcolor + "\" '> & nbsp; <a href = '"+ sublayerhttplist [H] +" 'class =' "+ subtablehrefclassname +" 'target = '"+ target +"'> "+ sublayerlist [H] + "</a> & nbsp; </TD> </tr> ");
}
Document. Write ("</table> ");
}
Document. Write ("</div> ");
}

// -------------------------------- Hide control of the sub-menu --------------------------//
Function layervib (type, num ){
VaR H = type;
VaR temp = (H = 'visible '? 'Hided': 'visable ')
For (VAR I = 0; I <mainlayer. length; I ++ ){
VaR E = eval ('document. All. Index' + I + '. style ');
VaR H = eval (I );
If (I = num ){
E. Visibility = Type
}
Else {
E. Visibility = temp
};
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.