JavaScript drop-down menu example sharing

Source: Internet
Author: User

JavaScript drop-down menu example sharing

Css+js drop-down menu

Full code:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title>javascript drop-down menu-www.yuju100.com-statement net </title>
<style type= "Text/css" >
* {
padding:0;
margin:0;
}
Body {
Font-family:verdana, Sans-serif;
Font-size:small;
}
#navigation, #navigation Li ul {
List-style-type:none;
}
#navigation {
margin:20px;
}
#navigation Li {
Float:left;
Text-align:center;
position:relative;
}
#navigation li A:link, #navigation li a:visited {
Display:block;
Text-decoration:none;
Color: #000;
width:120px;
height:40px;
line-height:40px;
border:1px solid #fff;
border-width:1px 1px 0 0;
Background: #c5dbf2;
padding-left:10px;
}
#navigation li A:hover {
Color: #fff;
Background: #2687eb;
}
#navigation Li ul li a:hover {
Color: #fff;
Background: #6b839c;
}
#navigation Li ul {
Display:none;
Position:absolute;
top:40px;
left:0;
margin-top:1px;
width:120px;
}
#navigation Li ul Li ul {
Display:none;
Position:absolute;
top:0px;
left:130px;
margin-top:0;
margin-left:1px;
width:120px;
}
</style>
<script type= "Text/javascript" >
function Displaysubmenu (LI) {
var submenu = Li.getelementsbytagname ("ul") [0];
SubMenu.style.display = "block";
}
function Hidesubmenu (LI) {
var submenu = Li.getelementsbytagname ("ul") [0];
SubMenu.style.display = "None";
}
</script>
<body>
<ul id= "Navigation" >
<li onmouseover= "Displaysubmenu (This)" onmouseout= "Hidesubmenu (This)" >
<a href= "#" > Column 1</a>
<ul>
<li><a href= "#" > Column 1-> menu 1</a></li>
<li><a href= "#" > Column 1-> menu 2</a></li>
<li><a href= "#" > Column 1-> menu 3</a></li>
<li><a href= "#" > Column 1-> menu 4</a></li>
</ul>
</li>
<li onmouseover= "Displaysubmenu (This)" onmouseout= "Hidesubmenu (This)" >
<a href= "#" > Column 2</a>
<ul>
<li><a href= "#" > Column 2-> menu 1</a></li>
<li><a href= "#" > Column 2-> menu 2</a></li>
<li><a href= "#" > Column 2-> menu 3</a></li>
<li><a href= "#" > Column 2-> menu 4</a></li>
<li><a href= "#" > Column 2-> menu 5</a></li>
</ul>
</li>
<li onmouseover= "Displaysubmenu (This)" onmouseout= "Hidesubmenu (This)" >
<a href= "#" > Column 3</a>
<ul>
<li onmouseover= "Displaysubmenu (This)" onmouseout= "Hidesubmenu (This)" >
<a href= "#" > Column 3-> menu 1</a>
<ul>
<li><a href= "#" > Menu 1-> submenu 1</a></li>
<li><a href= "#" > Menu 1-> submenu 2</a></li>
<li><a href= "#" > Menu 1-> submenu 3</a></li>
<li><a href= "#" > Menu 1-> submenu 4</a></li>
</ul>
</li>
<li><a href= "#" > Column 3-> menu 2</a></li>
<li onmouseover= "Displaysubmenu (This)" onmouseout= "Hidesubmenu (This)" >
<a href= "#" > Column 3-> menu 3</a>
<ul>
<li><a href= "#" > Menu 3-> submenu 1</a></li>
<li><a href= "#" > Menu 3-> submenu 2</a></li>
<li><a href= "#" > Menu 3-> submenu 3</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</body>

Personal feeling this JS menu is also good, small and concise, very practical.

Articles you may be interested in:
    • jquery Easyui Multi-Select drop-down menu instance
    • jquery linkage drop-down menu implementation code
    • Jquery-easyui example of creating a drop-down menu
    • jquery infinitely graded drop-down menu
    • jquery drop-down menu example of the UL tag drop-down menu
    • jquery drop-down menu effect jquery Click the pop-up drop-down menu example
    • Change the JS code for the background style of the Select drop-down menu

JavaScript drop-down menu example sharing

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.