提示:您可以先修改部分代碼再運行
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title></title><style type="text/css"><!--*{margin:0;padding:0;border:0;}body {font-family: arial, 宋體, serif;font-size:12px;}#nav {width:180px; line-height: 24px; list-style-type: none;text-align:left; /*定義整個ul菜單的行高和背景色*/}#nav a {width: 160px; display: block;padding-left:20px;/*Width(一定要),否則下面的Li會變形*/}#nav li {background:#CCC; /*一級目錄的背景色*/border-bottom:#FFF 1px solid; /*下面的一條白邊*/float:left;/*float:left,本不應該設定,但由於在Firefox不能正常顯示繼承Nav的width,限制寬度,li自動向下延伸*/}#nav li a:hover{background:#CC0000; /*一級目錄onMouseOver顯示的背景色*/}#nav a:link {color:#666; text-decoration:none;}#nav a:visited {color:#666;text-decoration:none;}#nav a:hover {color:#FFF;text-decoration:none;font-weight:bold;}/*==================二級目錄===================*/#nav li ul {list-style:none;text-align:left;}#nav li ul li{ background: #EBEBEB; /*二級目錄的背景色*/}#nav li ul a{ padding-left:20px; width:160px;/* padding-left二級目錄中文字向右移動,但Width必須重新設定=(總寬度-padding-left)*/}/*下面是二級目錄的連結樣式*/#nav li ul a:link {color:#666; text-decoration:none;}#nav li ul a:visited {color:#666;text-decoration:none;}#nav li ul a:hover {color:#F3F3F3;text-decoration:none;font-weight:normal;background:#CC0000;/* 二級onmouseover的字型顏色、背景色*/}/*==============================*/#nav li:hover ul {left: auto;}#nav li.sfhover ul {left: auto;}#nav ul.collapsed {display: none;}--></style><script type=text/javascript><!--var LastLeftID = "";function menuFix() {var obj = document.getElementById("nav").getElementsByTagName("li");for (var i=0; i<obj.length; i++) { obj[i].onmouseover=function() { this.className+=(this.className.length>0? " ": "") + "sfhover"; } obj[i].onMouseDown=function() { this.className+=(this.className.length>0? " ": "") + "sfhover"; } obj[i].onMouseUp=function() { this.className+=(this.className.length>0? " ": "") + "sfhover"; } obj[i].onmouseout=function() { this.className=this.className.replace(new RegExp("( ?|^)sfhover\b"), ""); }}}function DoMenu(emid){var obj = document.getElementById(emid); obj.className = (obj.className.toLowerCase() == "expanded"?"collapsed":"expanded");if((LastLeftID!="")&&(emid!=LastLeftID)) //關閉上一個Menu{ document.getElementById(LastLeftID).className = "collapsed";}LastLeftID = emid;}function GetMenuID(){var MenuID="";var _paramStr = new String(window.location.href);var _sharpPos = _paramStr.indexOf("#");if (_sharpPos >= 0 && _sharpPos < _paramStr.length - 1){ _paramStr = _paramStr.substring(_sharpPos + 1, _paramStr.length);}else{ _paramStr = "";}if (_paramStr.length > 0){ var _paramArr = _paramStr.split("&"); if (_paramArr.length>0) { var _paramKeyVal = _paramArr[0].split("="); if (_paramKeyVal.length>0) { MenuID = _paramKeyVal[1]; } } /* if (_paramArr.length>0) { var _arr = new Array(_paramArr.length); } //取所有#後面的,菜單只需用到Menu //for (var i = 0; i < _paramArr.length; i++) { var _paramKeyVal = _paramArr[i].split('='); if (_paramKeyVal.length>0) { _arr[_paramKeyVal[0]] = _paramKeyVal[1]; } } */}if(MenuID!=""){ DoMenu(MenuID)}}GetMenuID(); //*這兩個function的順序要注意一下,不然在Firefox裡GetMenuID()不起效果menuFix();--></script></head><body><ul id="nav"><li>aaaa<ul id="ChildMenu1" class="collapsed"><li>www.netany.net</li> <li>www.netany.net</li><li>www.netany.net</li></ul></li><li>bbbb<ul id="ChildMenu2" class="collapsed"><li>支付</li><li>網上支付</li><li>登記匯款</li><li>線上招領</li><li>曆史帳務</li></ul></li><li>cccc<ul id="ChildMenu3" class="collapsed"><li>登入</li><li>管理</li><li>管理</li><li>管理</li></ul></li><li>dddd<ul id="ChildMenu4" class="collapsed"><li>登入</li><li>管理</li><li>管理</li><li>管理</li></ul></li><li>eeee<ul id="ChildMenu5" class="collapsed"><li>登入</li><li>管理</li><li>管理</li><li>管理</li></ul></li></ul></body></html>
提示:您可以先修改部分代碼再運行