下拉的DIV+CSS+JS二级树型菜单

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>DIV+CSS+JS二级树型菜单,展开后刷新无影响</title>
<style type="text/css">
<!--
body { font-family: arial, 宋体, serif; font-size:12px; }
* { margin:0px; padding:0px; }
#nav { width:174px; line-height: 24px; list-style-type: none; text-align:left;
}

#nav a { width: 174px; display: block; padding-left:20px;
}
#nav li { border-bottom:#FFF 1px solid; float:left; background-color: #FECFD6; color:#DD1336; font-weight:bold; }
#nav li a:hover { background:#F85B78; }
#nav a:link { color:#DD1336; text-decoration:none; }
#nav a:visited { color:#DD1336; 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:#ffecef; font-weight:normal; }
#nav li ul a { padding-left:20px; width:174px;
}

#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:#FFAA1C;
}

#nav li:hover ul { left: auto; }
#nav li.sfhover ul { left: auto; }
#content { clear: left; }
#nav ul.collapsed { display: none; }
-->
#PARENT { width:174px; }
</style>
</head>
<body>
<div id="PARENT">
  <ul id="nav">
    <li><a href="#Menu=ChildMenu1" onClick="DoMenu(‘ChildMenu1‘)">GDI 事业相关</a>
      <ul id="ChildMenu1" class="collapsed">
        <li><a href=http://www.yf321.ws/gdi/?id=gdivideo target="_blank">·GDI事业影音在线播放</a></li>
        <li><a href=http://www.yf321.ws/gdi/?id=gdi target="_blank">·GDI公司简介</a></li>
        <li><a href=http://www.yf321.ws/gdi/?id=product target="_blank">·GDI事业产品介绍</a></li>
        <li><a href=http://www.yf321.ws/gdi/?id=commision target="_blank">·GDI创业奖金制度</a></li>
        <li><a href=http://www.yf321.ws/gdi/?id=international target="_blank">·GDI营销八国语言网</a></li>
        <li><a href=https://www.website.ws/index.dhtml target="_blank">·GDI公司官方网站</a></li>
        <li><a href=http://freedom.ws/yf321 target="_blank">·GDI全球自动营销网</a></li>
        <li><a href=https://www.website.ws/members/index.dhtml target="_blank">·GDI会员登录</a></li>
        <li><a href=http://email.ws/webmail/src/login.ph target="_blank">·GDI独立邮箱登录</a></li>
        <li><a href=http://www.yf321.ws/gdi/?id=share target="_blank">·GDI全球经营者分享</a></li>
      </ul>
    </li>
    <li><a href="#Menu=ChildMenu2" onClick="DoMenu(‘ChildMenu2‘)">GDI 注册相关</a>
      <ul id="ChildMenu2" class="collapsed">
<LI><A href="https://www.google.com/accounts/NewAccount?service=mail&continue=http%3A%2F%2Fmail.google.com%2Fmail%2Fe-11-1111a5e8318fc348f26835c65fc90622-4387fa939605116ad07dd86c394dfea550a83c67&type=2" target="_blank">·Gmail 邮箱注册地址</a></LI>
<LI><A href="https://www.paypal.com/c2/mrb/pal=LCWWTWZU34BDG" target="_blank">·PAYPAL网银注册地址</a></LI>
<LI><A href="https://www.website.ws/kvmlm2/dispatch.dhtml?sponsor=yf321" target="_blank">·GDI会员注册地址</a></LI>
<LI><A href="http://www.icbc.com.cn/icbc/" target="_blank">·中国工商银行网上银行</a></LI>
<LI><A href="https://ibsbjstar.ccb.com.cn/V5/index.html#" target="_blank">·中国建设银行网上银行</a></LI>
<LI><A href="http://www.cmbchina.com/personal+business/netbank" target="_blank">·招商银行网上银行</a></LI>
<LI><A href="https://www.alipay.com/" target="_blank">·支付宝登录</a></LI>
<LI><A href="http://www.yf321.ws/gdi/?id=3step">·三步开创新的人生</a></LI>
<LI><A href="http://www.yf321.ws/gdi/?id=contact">·注册GDI的3种方式</a></LI>
<LI><A href="http://www.yf321.ws/gdi/?id=reg">·GDI会员注册中文图解</a></LI>
<LI><A href="http://www.yf321.ws/gdi/?id=paypal">·PAYPAL注册及认证教程</a></LI>
<LI><A href="http://www.yf321.ws/gdi/?id=qa">·GDI注册常见问题</a></LI>
      </ul>
    </li>
    <li><a href="#Menu=ChildMenu3" onClick="DoMenu(‘ChildMenu3‘)">GDI 金色未来相关</a>
      <ul id="ChildMenu3" class="collapsed">
<LI><A href="http://www.yf321.ws/gdi/?id=gfsaudio" target="_blank">·金色未来影音说明</a></LI>
<LI><A href="http://www.yf321.ws/gdi/?id=gfsgood" target="_blank">·成为金色未来会员的好处</a></LI>
<LI><A href="http://www.yf321.ws/gdi/?id=gfssource" target="_blank">·金色未来特有资源</a></LI>
<LI><A href="http://www.yf321.ws/gdi/?id=gfsmember" target="_blank">·金色未来成员见证</a></LI>
<LI><A href="http://168buting.cn/" target="_blank">·GDI金色未来会员区</a></LI>
<LI><A href="http://www.yf321.ws/gdi/blog/" target="_blank">·我的经营日志</a></LI>
      </ul>
    </li>
    <li><a href="#Menu=ChildMenu4" onClick="DoMenu(‘ChildMenu4‘)">GDI友情链接</a>
      <ul id="ChildMenu4" class="collapsed">
<LI><A href="http://blog.sina.com.cn/qsearn" target="_blank">·yf321新浪站</a></LI>
<LI><A href="http://yfws.blog.hexun.com/" target="_blank">·yf321和讯空间</a></LI>
<LI><A href="http://www.yf321.ws/" target="_blank">·GDI网域财富</a></LI>
<LI><A href="http://meilishiji.ws/" target="_blank">·meilishiji.ws网站</a></LI>
<LI><A href="http://123ok.ws/" target="_blank">·123ok.ws网站</a></LI>
<LI><A href="http://5173.ws/" target="_blank">·5173.ws网站</a></LI>
<LI><A href="http://soho521.ws/" target="_blank">·soho521.ws网站</a></LI>
<LI><A href="http://www.wang1314.com/" target="_blank">·网络收藏夹</a></LI>
      </ul>
    </li>
    <li><a href="#Menu=ChildMenu5" onClick="DoMenu(‘ChildMenu5‘)">推荐网站</a>
      <ul id="ChildMenu5" class="collapsed">
        <li><a href="http://yf321.ws/mdg" target="_blank">MDG国际</a></li>
        <li><a href="http://www.mdgzy.com/" target="_blank">MDG中赢团队</a></li>
        <li><a href="http://www.5itaotao.cn" target="_blank">我爱淘淘</a></li>
        <li><a href=##Menu=ChildMenu5>菜单五</a></li>
        <li><a href=##Menu=ChildMenu5>菜单五</a></li>
        <li><a href=##Menu=ChildMenu5>菜单五</a></li>
        <li><a href=##Menu=ChildMenu5>菜单五</a></li>
        <li><a href=##Menu=ChildMenu5>菜单五</a></li>
        <li><a href=##Menu=ChildMenu5>菜单五</a></li>
        <li><a href=#C#Menu=ChildMenu5>菜单五</a></li>
        <li><a href=##Menu=ChildMenu5>菜单五</a></li>
        <li><a href=##Menu=ChildMenu5>菜单五</a></li>
      </ul>
    </li>
    <li><a href="#Menu=ChildMenu6" onClick="DoMenu(‘ChildMenu6‘)">菜单六</a>
      <ul id="ChildMenu6" class="collapsed">
        <li><a href=##Menu=ChildMenu6>菜单六</a></li>
        <li><a href=##Menu=ChildMenu6>菜单六</a></li>
        <li><a href=##Menu=ChildMenu6>菜单六</a></li>
      </ul>
    </li>
    <li><a href="#Menu=ChildMenu7" onClick="DoMenu(‘ChildMenu7‘)">菜单七</a>
      <ul id="ChildMenu7" class="collapsed">
        <li><a href=##Menu=ChildMenu7>菜单七</a></li>
        <li><a href=##Menu=ChildMenu7>菜单七</a></li>
      </ul>
    </li>
    <li><a href="#Menu=ChildMenu8" onClick="DoMenu(‘ChildMenu8‘)">菜单八</a>
      <ul id="ChildMenu8" class="collapsed">
        <li><a href=##Menu=ChildMenu8>菜单八</a></li>
        <li><a href=##Menu=ChildMenu8>菜单八</a></li>
        <li><a href=##Menu=ChildMenu8>菜单八</a></li>
      </ul>
    </li>
    <li><a href="#Menu=ChildMenu9" onClick="DoMenu(‘ChildMenu9‘)">菜单九</a>
      <ul id="ChildMenu9" class="collapsed">
        <li><a href=##Menu=ChildMenu9>菜单九</a></li>
        <li><a href=##Menu=ChildMenu9>菜单九</a></li>
        <li><a href=##Menu=ChildMenu9>菜单九</a></li>
      </ul>
    </li>
    <li><a href="#Menu=ChildMenu10" onClick="DoMenu(‘ChildMenu10‘)">菜单十</a>
      <ul id="ChildMenu10" class="collapsed">
        <li><a href=##Menu=ChildMenu10>菜单十</a></li>
      </ul>
    </li>
  </ul>
</div>
<script type=text/javascript><!--
var LastLeftID = "";
function menuFix() {
 var obj = document.getElementByIdx("nav").getElementsByTagName_r("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.getElementByIdx(emid);
 obj.className = (obj.className.toLowerCase() == "expanded"?"collapsed":"expanded");
 if((LastLeftID!="")&&(emid!=LastLeftID)) //关闭上一个Menu
 {
  document.getElementByIdx(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(MenuID!="")
 {
  DoMenu(MenuID)
 }
}
GetMenuID(); //*这两个function的顺序要注意一下,不然在Firefox里GetMenuID()不起效果
menuFix();
--></script>
</html>

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。