Webpage skin replacement program that is freely switched between the horizontal drop-down menu and the vertical drop-down menu

Source: Internet
Author: User

Today, I finally finished a webpage skin replacement program that allows you to switch between the horizontal drop-down menu and the vertical drop-down menu. It applies the horizontal drop-down menu, vertical drop-down menu, and webpage skin replacement techniques.

Invalid.

Content of the test.html file:

<! Doctype HTML public "-// W3C // dtd xhtml 1.0 strict // en"
Http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd>
<HTML xmlns = "http://www.w3.org/1999/xhtml" XML: lang = "en" lang = "en">
<Head>
<SCRIPT>
Function startlist ()
{

If (document. All)
{

VaR navroot = Document. getelementbyid ("nav ");
For (VAR I = 0; I <navroot. childnodes. length; I ++)
{
Node = navroot. childnodes [I];

If (node. nodename = "Li ")
{

Node. onmouseover = function () {This. classname = "hover ";};
Node. onmouseout = function () {This. classname = "";};
}
}
}
}
Window. onload = startlist;

Function changeskin ()
{
VaR pathname = Document. getelementbyid ("cssfile"). href;
VaR filename = pathname. substring (pathname. lastindexof ("/") + 1 );
Document. getelementbyid ("cssfile"). href = (filename = "h.css "? "V.css": "h.css ");
}
</SCRIPT>

<LINK rel = "stylesheet" type = "text/CSS" href = "h.css" id = "cssfile"/>
</Head>
<Body>
<Ul id = "nav">
<Li> JAVA Training
<Ul>
<Li> JAVA basics </LI>
<Li> JAVA employment practices </LI>
<Li> excellent Java skills </LI>
</Ul>
</LI>
<Li>. Net Training
<Ul>
<Li>. Net Basic Improvement </LI>
<Li>. net employment practices </LI>
<Li> excellent. Net experts </LI>
</Ul>
</LI>
<Li> <a href = "#" onclick = "changeskin ()"> change style </a> </LI>
</Ul>
<Div id = "content">
Content Area
</Div>
</Body>
</Html>

H.css file content:

# Content {clear: Both ;}
Ul {
List-style: none;
Margin: 0px;
Padding: 0px;
}

Li {
Margin: 0px;
Padding: 0px;
Float: left;
Width: 100px;
Height: 20px;
Border: 1px solid # DDD;
Position: relative;
}
Li ul {
Background-color: # Eee;
Display: none;
Top: 20px;
Left: 0px;
Position: absolute;
}
Li: hover, Li. Hover {background-color: # Eee ;}
Li: hover, Li. Hover ul {
Display: block;
}

V.css file content:

# Nav {float: Left ;}
Ul {
List-style: none;
Margin: 0px;
Padding: 0px;
}

Li {
Margin: 0px;
Padding: 0px;
Width: 100px;
Height: 20px;
Border: 1px solid # DDD;
Position: relative;
}
Li ul {
Background-color: # Eee;
Display: none;
Top: 0px;
Left: 100px;
Position: absolute;
}
Li: hover, Li. Hover {background-color: # Eee ;}
Li: hover, Li. Hover ul {
Display: block;
}

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.