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;
}