CSS + JavaScript uses display: NONE/block to construct the pop-up menu

Source: Internet
Author: User

<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> new document </title>
<Meta name = "generator" content = "editplus"/>
<Meta name = "author" content = ""/>
<Meta name = "keywords" content = ""/>
<Meta name = "Description" content = ""/>
<Style type = "text/CSS">
* {Margin: 0px; padding: 0px; border = 0; List-style: none; font-family: verdana ;}

# Nav {font-size: 10pt}

# Nav A {text-Decoration: None}
# Nav A: link {color: #999}
# Nav A: visited {color: #999}
# Nav A: hover {color: Black}
# Nav A: active {color: #999}

# Nav Li {width: 120px; padding: 4px; Border: solid 1px; margin: 3px; text-align: center; position: relative}/* the length of the entire level-1 menu is 120 + 4 + 1 + 3 = 128px */

# Nav Li ul {display: none; position: absolute; left: 129px; top:-4px; Background: # fff}/* padding: 4px. Use display: none to hide the menu, background: # fff is used to fill gaps. Otherwise, there is a problem with IE */

/* Important for FF */
# Nav Li ul Li a {display: inline-block; Background: # Eee; Border: solid 1px; width: 120px}/* use display to convert a into a block element, prepare for the right-play effect */
# Nav Li ul Li a {display: inline-block}
/* Set the appearance of a submenu with a link */
# Nav Li ul Li A: link {color: Black}
# Nav Li ul Li A: visited {color: Black}
# Nav Li ul Li A: hover {position: relative; left: 8px}/* right play effect */
# Nav Li ul Li A: active {color: Black}

# Nav Li: hover ul, # nav Li. Over ul {display: block}/* display the hidden menu */

</Style>
<SCRIPT type = "text/JavaScript">
VaR A = function ()
{
VaR nav = Document. getelementbyid ('nav ');
VaR Lis = nav. childnodes;
For (VAR I = 0; I <Lis. length; I ++)
{
If (LIS [I]. nodename = 'lil ')
{
VaR childli = Lis [I];
Childli. onmouseover = function () {This. classname = 'over ';}
Childli. onmouseout = function () {This. classname = '';}
}
}
}
Window. onload =;
</SCRIPT>
</Head>
<Body>
<Ul id = "nav">
<Li> <a href = "#1"> product introduction </a>
<Ul>
<Li> <a href = "#1"> link </a> </LI>
</Ul>
</LI>
<Li> product introduction
<Ul>
<Li> <a href = "#1"> link </a> </LI>
<Li> <a href = "#1"> link </a> </LI>
</Ul>
</LI>
<Li> product introduction
<Ul>
<Li> <a href = "#1"> link </a> </LI>
<Li> <a href = "#1"> link </a> </LI>
<Li> <a href = "#1"> link </a> </LI>
</Ul>
</LI>
<Li> product introduction
<Ul>
<Li> <a href = "#1"> link </a> </LI>
<Li> <a href = "#1"> link </a> </LI>
<Li> <a href = "#1"> link </a> </LI>
<Li> <a href = "#1"> link </a> </LI>
</Ul>
</LI>
<Li> product introduction
<Ul>
<Li> <a href = "#1"> link </a> </LI>
<Li> <a href = "#1"> link </a> </LI>
<Li> <a href = "#1"> link </a> </LI>
<Li> <a href = "#1"> link </a> </LI>
<Li> <a href = "#1"> link </a> </LI>
</Ul>
</LI>
</Ul>
</Body>
</Html>

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.