博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
div+css+js 树形菜单
阅读量:5853 次
发布时间:2019-06-19

本文共 7306 字,大约阅读时间需要 24 分钟。

hot3.png

代码:
<div class="main_2">
   <div class="m_left">
     <ul class="nav">
        <li id="bottom_none"><a href="#"  onClick="DoMenu('ChildMenu1')">税务登记</a>
          <ul id="ChildMenu1" class="expanded">
            <li id="border_top"><a href="biangengdengji.html">变更登记</a></li>
            <li><a href="shelidengji.html">设立登记</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 id="bottom_none"><a href="#" onClick="DoMenu('ChildMenu2')">认定管理</a>
          <ul id="ChildMenu2" class="collapsed">
            <li id="border_top"><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 id="bottom_none"><a href="#" onClick="DoMenu('ChildMenu3')">防伪税控</a>
          <ul id="ChildMenu3" class="collapsed">
            <li id="border_top"><a href="fangzhishuishou.html">防伪税控</a></li>
          </ul>
        </li>
        <li id="bottom_none"><a href="#" onClick="DoMenu('ChildMenu6')">发票管理</a>
          <ul id="ChildMenu6" class="collapsed">
            <li id="border_top"><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 id="bottom_none"><a href="#" onClick="DoMenu('ChildMenu4')">账簿管理</a>
          <ul id="ChildMenu4" class="collapsed">
            <li id="border_top"><a href="#">记账核算</a></li>
            <li><a href="#">记账核算</a></li>
            <li><a href="#">记账核算</a></li>
            <li><a href="#">记账核算</a></li>
          </ul>
        </li>
        <li id="bottom_none"><a href="#" onClick="DoMenu('ChildMenu5')">纳税申报</a>
          <ul id="ChildMenu5" class="collapsed">
            <li id="border_top"><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 id="bottom_none"><a href="#" onClick="DoMenu('ChildMenu7')">税款缴纳</a>
          <ul id="ChildMenu7" class="collapsed">
            <li id="border_top"><a href="#">延期缴纳税款</a></li>
            <li><a href="#">延期缴纳税款</a></li>
            <li><a href="#">延期缴纳税款</a></li>
          </ul>
        </li>
        <li id="bottom_none"><a href="#" onClick="DoMenu('ChildMenu8')">证明管理</a>
          <ul id="ChildMenu8" class="collapsed">
            <li id="border_top"><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 id="bottom_none"><a href="#" onClick="DoMenu('ChildMenu9')">特殊税种</a>
          <ul id="ChildMenu9" class="collapsed">
            <li id="border_top"><a href="#">车辆购置税</a></li>
          </ul>
        </li>
        <li id="bottom_none"><a href="#" onClick="DoMenu('ChildMenu10')">纳税检查</a>
          <ul id="ChildMenu10" class="collapsed">
            <li id="border_top"><a href="#">税务稽查</a></li>
            <li><a href="#">税务违法违章的处罚</a></li>
            <li><a href="#">税务机关行政执法的依据</a></li>
            <li><a href="#">税务行政处罚听证</a></li>
          </ul>
        </li>
        <li id="bottom_none"><a href="#" onClick="DoMenu('ChildMenu11')">行政许可</a>
          <ul id="ChildMenu11" class="collapsed">
            <li id="border_top"><a href="#">企业衔头发票印制审批</a></li>
            <li><a href="#">企业衔头发票印制审批</a></li>
            <li><a href="#">企业衔头发票印制审批</a></li>
            <li><a href="#">企业衔头发票印制审批</a></li>
          </ul>
        </li>
        <li id="bottom_none"><a href="#" onClick="DoMenu('ChildMenu12')">税收优惠</a>
          <ul id="ChildMenu12" class="collapsed">
            <li id="border_top"><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 id="bottom_none"><a href="#" onClick="DoMenu('ChildMenu13')">行政救济</a>
          <ul id="ChildMenu13" class="collapsed">
            <li id="border_top"><a href="#">税务行政赔偿业务流程</a></li>
            <li><a href="#">税务行政赔偿业务流程</a></li>
            <li><a href="#">税务行政赔偿业务流程</a></li>
            <li><a href="#">税务行政赔偿业务流程</a></li>
          </ul>
        </li>
        <li id="bottom_none"><a href="#" onClick="DoMenu('ChildMenu14')">税务代理</a>
          <ul id="ChildMenu14" class="collapsed">
            <li id="border_top"><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 id="bottom_none"><a href="#" onClick="DoMenu('ChildMenu15')">担保担保</a>
          <ul id="ChildMenu15" class="collapsed">
            <li id="border_top"><a href="#">担保</a></li>
          </ul>
        </li>
       </ul>
      </div>
    
     <div class="m_right"></div>
    </div>
CSS样式:
body{margin:0px;padding:0px;color:#585858;font-size:12px;font-family: "宋体";line-height:20px;}
.clear{clear:both;}
ul{margin: 0;padding: 0;list-style-type: none;}
.main_2{width:805px; float:right;}
.m_left{width:190px; float:left;}
.m_right{ width:608px; float:right;}
            .nav {
             width:190px;
             list-style-type: none;
             text-align:left;
             overflow:hidden;
               
            }
           
            .nav a {
             width: 168px;
             display: block;
             padding-left:10px;
             
            }
            .nav li {
                border-top:#ebebeb 1px solid;
                border-bottom:#ebebeb 1px solid;
                float:left;
                line-height:28px;
                background-color: #f5f5f5;font-weight:bold;
                            }
            .nav li a{
                background-image: url(../images/jiantou.gif);
                background-repeat: no-repeat;
               
                background-position: 10px 12px;
                padding-left:20px;
                font-size: 14px;
                color:#585858;
                text-decoration: none;   
            }
            .nav li a:hover,.nav li a.hover{
                color:#4c657e;
                background-color: #f5f5f5;
               
             }
           
            .nav li ul {
             list-style:none;
             text-align:left;
             
            }
            .nav li ul li{
                border:none;
                background-color: #fff;
                 padding-left:3px;
                background-image: url(../images/dian.gif);
                background-repeat: no-repeat;
                background-position: 15px 10px; font-weight:normal;
            }
            .nav li ul li a{
                background-image: none;
                font-size:12px;
            }
            .nav li ul li a:hover,.nav li ul li a.hover {
                color:#4c657e;
                text-decoration:none;
                font-weight:normal;
                background:none;
                background-image: none;
            }
            .nav ul.collapsed {
             display: none;
            }
            #bottom_none{
            border-bottom: none;
            }
            #border_top{
            border-top:  solid 1px #ebebeb;
            }
js:
var LastLeftID = "";
function menuFix() {
 var obj = document.getElementByIdx_x("nav").getElementsByTagName_r("li");
 
 for (var i=0; i<obj.length; i++) {
  obj[i].οnmοuseοver=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].οnmοuseοut=function() {
   this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"), "");
  }
 }
}
function DoMenu(emid)
{
 var obj = document.getElementByIdx_x(emid);
 obj.className = (obj.className.toLowerCase() == "expanded"?"collapsed":"expanded");
 if((LastLeftID!="")&&(emid!=LastLeftID)) //关闭上一个Menu
 {
  document.getElementByIdx_x(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();

本文转载:

转载于:https://my.oschina.net/u/1161556/blog/141990

你可能感兴趣的文章
Android一些问题的解决方案
查看>>
ios之UIToolBar
查看>>
Luogu P4707 重返现世
查看>>
目标与绩效管理实战专家胡立
查看>>
2014手机分析图
查看>>
一元多项式相加
查看>>
commandLink/commandButton/ajax backing bean action/listener method not invoked (转)
查看>>
软件工作的大环境
查看>>
梅沙教育APP简单分析-版本:iOS v1.2.21-Nathaneko-佳钦
查看>>
Word中如何设置图片与段落的间距为半行
查看>>
Windows Server 2008 RemoteApp---发布应用程序
查看>>
白帽子技术分析会话劫持实战讲解
查看>>
我的友情链接
查看>>
yum的三种方式
查看>>
Redis分布式缓存安装和使用
查看>>
20天精通 Windows 8:系列课程资料集
查看>>
html5 <figure> 标签
查看>>
开源监控软件 Hyperic 的两种插件
查看>>
TOMCAT
查看>>
Spark学习记录(二)Spark集群搭建
查看>>