nbsp;html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Div+CSS+JS树型菜单,可刷新 <script><!-- <br />var LastLeftID = ""; <br /> <br />function menuFix() { <br /> var obj = document.getElementById("nav").getElementsByTagName("li"); <br /> <br /> for (var i=0; i<obj.length; i++) { <br /> obj[i].onmouseover=function() { <br /> this.className+=(this.className.length>0? " " : "") + "sfhover" ; <br /> } <br /> obj[i].onMouseDown=function() { <br /> this.className+=(this.className.length>0? " " : "") + "sfhover" ; <br /> } <br /> obj[i].onMouseUp=function() { <br /> this.className+=(this.className.length>0? " " : "") + "sfhover" ; <br /> } <br /> obj[i].onmouseout=function() { <br /> this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), ""); <br /> } <br /> } <br />} <br /> <br />function DoMenu(emid) <br /> { <br /> var obj = document.getElementById(emid); <br /> obj.className = (obj.className.toLowerCase() == "expanded"?"collapsed" : "expanded") ; <br /> if((LastLeftID!="")&&(emid!=LastLeftID)) //关闭上一个Menu <br /> { <br /> document.getElementById(LastLeftID).className = "collapsed"; <br /> } <br /> LastLeftID = emid; <br />} <br /> <br />function GetMenuID() <br /> { <br /> <br /> var MenuID=""; <br /> var _paramStr = new String(window.location.href); <br /> <br /> var _sharpPos = _paramStr.indexOf("#"); <br /> <br /> if (_sharpPos >= 0 && _sharpPos < _paramStr.length - 1) <br /> { <br /> _paramStr = _paramStr.substring(_sharpPos + 1, _paramStr.length); <br /> } <br /> else <br /> { <br /> _paramStr = ""; <br /> } <br /> <br /> if (_paramStr.length > 0) <br /> { <br /> var _paramArr = _paramStr.split("&"); <br /> if (_paramArr.length>0) <br /> { <br /> var _paramKeyVal = _paramArr[0].split("="); <br /> if (_paramKeyVal.length>0) <br /> { <br /> MenuID = _paramKeyVal[1]; <br /> } <br /> } <br /> /* <br /> if (_paramArr.length>0) <br /> { <br /> var _arr = new Array(_paramArr.length); <br /> } <br /> <br /> //取所有#后面的,菜单只需用到Menu <br /> //for (var i = 0; i < _paramArr.length; i++) <br /> { <br /> var _paramKeyVal = _paramArr[i].split('='); <br /> <br /> if (_paramKeyVal.length>0) <br /> { <br /> _arr[_paramKeyVal[0]] = _paramKeyVal[1]; <br /> } <br /> } <br /> */ <br /> } <br /> <br /> if(MenuID!="") <br /> { <br /> DoMenu(MenuID) <br /> } <br />} <br /> <br />GetMenuID(); / /* 这两个function的顺序要注意一下,不然在Firefox里GetMenuID()不起效果 <br />menuFix(); <br />--></script>