XHTML+CSS+JavaScript製作的動態導航條(二)

來源:互聯網
上載者:User
代碼及簡要分析:

<style type="text/css">
<!--

#nv *{margin:0;padding:0;border:0;}

#nv {
line-height: 24px; list-style-type: none; background:#666;
}

#nv a {
display: block; width: 80px; text-align:center;
}

#nv a:link {
color:#666; text-decoration:none;
}
#nv a:visited {
color:#666;text-decoration:none;
}
#nv a:hover {
color:#FFF;text-decoration:none;font-weight:bold;
}

#nv li {
float: left; width: 80px; background:#CCC;
}
#nv li a:hover{
background:#999;
}
#nv li ul {
line-height: 27px; list-style-type: none;text-align:left;
left: -999em; width: 980px; position: absolute; float:left;
}
#nv li ul li{
float: left; width: 80px;
background: #F6F6F6;
}

#nv li ul a{
display: block; width: 80px;text-align:center;
}

#nv li ul a:link {
color:#666; text-decoration:none;
}
#nv li ul a:visited {
color:#666;text-decoration:none;
}
#nv li ul a:hover {
color:#F3F3F3;text-decoration:none;font-weight:normal;
background:#C00;
}

#nv li:hover ul {
left: 0;
}
#nv li.sfhover ul {
left: 0;
}
#content {
clear: left;
}

-->
</style>

<script type=text/javascript><!--//--><![CDATA[//><!--
function menuFix() {
var sfEls = document.getElementById("nv").getElementsByTagName("li");
for (var i=0; i<sfEls.length; i++) {
sfEls[i].onmouseover=function() {
this.className+=(this.className.length>0? " ": "") + "sfhover";
}
sfEls[i].onMouseDown=function() {
this.className+=(this.className.length>0? " ": "") + "sfhover";
}
sfEls[i].onMouseUp=function() {
this.className+=(this.className.length>0? " ": "") + "sfhover";
}
sfEls[i].onmouseout=function() {
this.className=this.className.replace(new RegExp("( ?|^)sfhover//b"),

"");
}
}
}
window.onload=menuFix;

//--><!]]></script>

</head>
<body>

<ul id="nv">
<li><a href="#">產品介紹</a>
<ul>
<li><a href="#">產品一</a></li>
<li><a href="#">產品一</a></li>
<li><a href="#">產品一</a></li>
<li><a href="#">產品一</a></li>
<li><a href="#">產品一</a></li>
<li><a href="#">產品一</a></li>
</ul>
</li>
<li><a href="#">服務介紹</a>
<ul>
<li><a href="#">服務二</a></li>
<li><a href="#">服務二</a></li>
<li><a href="#">服務二</a></li>
<li><a href="#">服務二服</a></li>
<li><a href="#">服務二服</a></li>
<li><a href="#">服務二</a></li>
</ul>
</li>
<li><a href="#">成功案例</a>
<ul>
<li><a href="#">案例三</a></li>
<li><a href="#">案例</a></li>
<li><a href="#">案例三案</a></li>
<li><a href="#">案例三案</a></li>
</ul>
</li>
<li><a href="#">關於我們</a>
<ul>
<li><a href="#">我們四</a></li>
<li><a href="#">我們四</a></li>
<li><a href="#">我們四</a></li>
<li><a href="#">我們四111</a></li>
</ul>
</li>

<li><a href="#">線上示範</a>
<ul>
<li><a href="#">示範</a></li>
<li><a href="#">示範</a></li>
<li><a href="#">示範</a></li>
<li><a href="#">示範示範</a></li>
<li><a href="#">示範示範</a></li>
<li><a href="#">示範示範</a></li>
<li><a href="#">示範示範</a></li>
<li><a href="#">示範示範</a></li>
</ul>
</li>
<li><a href="#">聯絡我們</a>
<ul>
<li><a href="#">聯絡聯絡</a></li>
<li><a href="#">聯絡聯絡</a></li>
<li><a href="#">聯絡</a></li>
<li><a href="#">聯絡聯絡</a></li>
<li><a href="#">聯絡聯絡</a></li>
<li><a href="#">聯絡聯絡</a></li>
<li><a href="#">聯絡聯絡</a></li>
</ul>
</li>

</ul>

相關文章

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.