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 >
<TD align=center onmousedown= "Flipmenu (DOCUMENT.ALL.MNU1)" > Integrated site </td>
Click on the link (implemented with onmousedown) to start the function
<TD align=center onmousedown= "Flipmenu (DOCUMENT.ALL.MNU2)" > Professional site </td>
Click on the link (implemented with onmousedown) to start the function
<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>
<TD valign= "Top" >
<table id=mnu1 width=100% style= "Visibility:hidden;" >
First set menu is not visible
<TR><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
<TR><TD onclick= "Menuhandler (Mnu1, ' www.163.com/')" >
<a href= "#" > NetEase </a> </td></tr>
<TR><TD onclick= "Menuhandler (Mnu1, ' www.sina.com/')" >
<a href= "#" > Sina net </a> </td></tr>
<TR><TD onclick= "Menuhandler (Mnu1, ' www.263.net/')" >
<a href= "#" > Capital online </a> </td></tr>
</table>
</td>
<TD valign= "Top" >
<table id=mnu2 width=100% style= "Visibility:hidden;" >
First set menu is not visible
<TR><TD onclick= "Menuhandler (Mnu2, ' www.aspsky.com/')" > <a href= "#" >
Dynamic Network </a> </td></tr>
<TR><TD onclick= "Menuhandler (Mnu2, ' www.jzzy.com/')" > <a href= "#" >
Resource Network </a> </td></tr>
<TR><TD onclick= "Menuhandler (Mnu2, ' www.phpuser.com/')" > <a href= "#" >
PHP Home </a> </td></tr>
</table>
</td>
<TD valign= "Top" >
<table id=mnu3 width=100% style= "Visibility:hidden;" >
First set menu is not visible
<TR><TD onclick= "Menuhandler (Mnu3, ' www.aspsky.com/')" > <a href= "#" >
Dynamic Network </a> </td></tr>
<TR><TD onclick= "Menuhandler (Mnu3, ' www.jzzy.com/')" > <a href= "#" >
Resource Network </a> </td></tr>
<TR><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>, 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 ... |