符合css規範的下拉式功能表(相容ff\ie6\ie7)

來源:互聯網
上載者:User

<style>
body{font-size:12px; font-family:"宋體";margin:0;padding:0;}
#menu {height:29px!important;height:30px;line-height:29px;list-style-type: none;background:#B5DCF9;}
#menu a {display: block; width: 80px; text-align:center;}
#menu a:link {color:#000; text-decoration:none;}
#menu a:visited {color:#000;text-decoration:none;}
#menu a:hover {color:#FFF;text-decoration:none;font-weight:bold;}
#menu li {float: left; width: 80px;   border-right:1px solid #fff;}
#menu li a:hover{background:#6699ff;}
#menu li ul {line-height: 25px; list-style-type: none;text-align:left;
left: -1860em; width: 180px; position: absolute;top:15px!important;top:29px;}
#menu li ul li{float: left; width: 130px;background: #6699ff;border-top:1px solid #fff}
#menu li ul a{display: block; width:120px!important;width: 130px;text-align:left;padding-left:10px;}
#menu li ul a:link {color:#fff; text-decoration:none;}
#menu li ul a:visited {color:#fff;text-decoration:none;}
#menu li ul a:hover {color:#000;text-decoration:none;font-weight:normal;background:#B5DCF9;}
#menu li:hover ul {left: auto;}
#menu li.sfhover ul {left: auto;}
#content {clear: left;}
</style>

<script type=text/javascript><!--//--><![CDATA[//><!--
function menuFix() {
var sfEls = document.getElementById("menu").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>

<div id="menu">
<li><a href="http://hi.baidu.com/dpxdqx">彥磊部落格首頁</a></li>
<li><a href="http://hi.baidu.com/dpxeqx">網頁技術</a>
   <ul>
    <li>
     <a href="http://hi.baidu.com/dpxdqx">DIV+CSS</a>
     <a href="http://hi.baidu.com/dpxdqx">JavaScrip</a>
     <a href="http://hi.baidu.com/dpxdqx">網頁基礎</a>
    </li>
  
  
   </ul>

</li>

</div>

 

相關文章

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.