The navigation menu Drop-down unfolds the method detailed explanation

Source: Internet
Author: User
Often see a very wonderful Drop-down navigation menu on the Internet, use is really very classic, and often have netizens asked about the production of the menu, so deliberately find a case, detailed analysis to everyone, and this example of the expansion is also very strong, you can make a very wonderful Drop-down menu set. Come with me soon, after reading you will understand, the original is also very simple to do:

Let's take a look at the demo (click on the menu):
Integrated Site | Professional Site One | Added a column
Sohu
Netease
New Long
Capital Online
Dynamic Network
Resource Network
The home of PHP
Dynamic Network
Resource Network
The home of PHP
<script language= "JavaScript" >
<!--Begin
var winprops = "Height=500,width=500,location=no,scrollbars=no,"
+ "Menubars=no,toolbars=no,resizable=yes"; Set the field for the Link Open Window property, which you can change arbitrarily, and call it below
var vismnu = ""; Set the Drop-down menu to start empty, that is, not display
var actmnu, url;

function Menuhandler (Actmnu,url)//Set functions that appear after clicking the link
{
Popup = window.open ("http://" +url, "Menupopup", winprops); Set the fields for open windows
Hidemenu (ACTMNU); Hide Actmnu Menu
}
function Flipmenu (ACTMNU)//Click on link-initiated functions
{
if (Vismnu = "")
ShowMenu (ACTMNU); If a drop-down menu is empty, the menu is displayed
Else
{
if (Vismnu = = actmnu)
Hidemenu (ACTMNU); If you've already shown it at first, hide the menu (that is, hide the menu for the second click)
Else
{
Hidemenu (VISMNU);
ShowMenu (ACTMNU);
}
}
}
The above is to set a menu to appear, another menu disappears, does not appear at the same time
function ShowMenu (ACTMNU)
{
ActMnu.style.background = "#889933"; Set the background color of a pop-up menu
actMnu.style.visibility = "visible"; The Settings menu is visible when you use this function
Vismnu = Actmnu;
}
function Hidemenu (ACTMNU)
{
ActMnu.style.background = ""; Invisible menu does not set background color
actMnu.style.visibility = "hidden"; The Settings menu is not visible when you use this function
Vismnu = "";
}
End-->
</script>
<table Name=navibar border=0>
<tr bgcolor= #FF9933 >
&LT;TD align=center onmousedown= "Flipmenu (DOCUMENT.ALL.MNU1)" > Integrated site </td>
Click on the link (implemented with onmousedown) to start the function
&LT;TD align=center onmousedown= "Flipmenu (DOCUMENT.ALL.MNU2)" > Professional site </td>
Click on the link (implemented with onmousedown) to start the function
&LT;TD align=center onmousedown= "Flipmenu (DOCUMENT.ALL.MNU3)" > Added a column </td>
Click on the link (implemented with onmousedown) to start the function
</tr>
<tr>
&LT;TD valign= "Top" >
<table id=mnu1 width=100% style= "Visibility:hidden;" >
First set menu is not visible
&LT;TR&GT;&LT;TD onclick= "Menuhandler (Mnu1, ' www.sohu.com/')" >
<a href= "#" > Sohu </a> </td></tr>
Click on the link (implemented with onclick) to start the pop-up function
&LT;TR&GT;&LT;TD onclick= "Menuhandler (Mnu1, ' www.163.com/')" >
<a href= "#" > NetEase </a> </td></tr>
&LT;TR&GT;&LT;TD onclick= "Menuhandler (Mnu1, ' www.sina.com/')" >
<a href= "#" > Sina net </a> </td></tr>
&LT;TR&GT;&LT;TD onclick= "Menuhandler (Mnu1, ' www.263.net/')" >
<a href= "#" > Capital online </a> </td></tr>
</table>
</td>
&LT;TD valign= "Top" >
<table id=mnu2 width=100% style= "Visibility:hidden;" >
First set menu is not visible
&LT;TR&GT;&LT;TD onclick= "Menuhandler (Mnu2, ' www.aspsky.com/')" > <a href= "#" >
Dynamic Network </a> </td></tr>
&LT;TR&GT;&LT;TD onclick= "Menuhandler (Mnu2, ' www.jzzy.com/')" > <a href= "#" >
Resource Network </a> </td></tr>
&LT;TR&GT;&LT;TD onclick= "Menuhandler (Mnu2, ' www.phpuser.com/')" > <a href= "#" >
PHP Home </a> </td></tr>
</table>
</td>
&LT;TD valign= "Top" >
<table id=mnu3 width=100% style= "Visibility:hidden;" >
First set menu is not visible
&LT;TR&GT;&LT;TD onclick= "Menuhandler (Mnu3, ' www.aspsky.com/')" > <a href= "#" >
Dynamic Network </a> </td></tr>
&LT;TR&GT;&LT;TD onclick= "Menuhandler (Mnu3, ' www.jzzy.com/')" > <a href= "#" >
Resource Network </a> </td></tr>
&LT;TR&GT;&LT;TD onclick= "Menuhandler (Mnu3, ' www.phpuser.com/')" > <a href= "#" >
PHP Home </a> </td></tr>
</table>
</td>
</tr>
</table>
Note:There is also a very important point to explain, you may feel that this menu will show a blank, in fact, this problem is not difficult to solve, you can change that <table> into <div&gt, and then give it a precise positioning, then all the problems are solved, You can make a very beautiful pull-down menu at your whim, and wait for something, just do it ...

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.