Using CSS and JS, just I recently have a site to use the Drop-down menu!_javascript

Source: Internet
Author: User

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd
<meta http-equiv= "Content-type" Content= "text/html; charset=gb2312 "/>
<title>nav</title>
<script language=" javascript "
//JavaScript Document

startlist = function () {
if (Document.all&&document.getelementbyid) {
Navroot = document.getElementById ("Nav");
for (i=0; i<navroot.childnodes.length; i++) {
node = navroot.childnodes[i];
if (node.nodename== "LI") {
Node.onmouseover=function () {
this.classname+= "over";
&NBSP}
 node.onmouseout=function () {
 this.classname=this.classname.replace ("Over", "");
&NBSP}
 }
 
 }
}
Window.onload=startlist;
</script>
<style type= "Text/css"
<!--
Body {
  font:normal 11px verdana;
 }

UL {
margin:0;
padding:0;
List-style:none;
width:150px; /* Width of Menu Items */
border-bottom:1px solid #ccc;
}

UL Li {
position:relative;
}

Li ul {
Position:absolute;
left:149px; /* Set 1px less than menu width * *
top:0;
Display:none;
}

/* Styles for Menu Items */
UL Li a {
Display:block;
Text-decoration:none;
Color: #777;
Background: #fff; /* IE6 Bug * *
padding:5px;
border:1px solid #ccc; /* IE6 Bug * *
border-bottom:0;
}

/* Holly Hack. IE Requirement \*/
* HTML ul li {float:left; height:1%;}
* HTML ul li a {height:1%;}
/* END * *

Li:hover ul, Li.over ul {display:block;}/* The Magic * *
-->
</style>

<body>
<ul id= "NAV" >
<li><a href= "#" >Home</a></li>
<li><a href= "#" >About</a>
<ul>
<li><a href= "#" >History</a></li>
<li><a href= "#" >Team</a></li>
<li><a href= "#" >Offices</a></li>
</ul>
</li>
<li><a href= "#" >Services</a>
<ul>
<li><a href= "#" >web design</a></li>
<li><a href= "#" >internet marketing</a></li>
<li><a href= "#" >Hosting</a></li>
<li><a href= "#" >domain names</a></li>
<li><a href= "#" >Broadband</a></li>
</ul>
</li>
<li><a href= "#" >contact us</a>
<ul>
<li><a href= "#" >united kingdom</a></li>
<li><a href= "#" >France</a></li>
<li><a href= "#" >USA</a></li>
<li><a href= "#" >Australia</a></li>
</ul>
</li>

</ul>
</body>

Related Article

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.