注册 登录
编程论坛 ASP.NET技术论坛

急!点击菜单后菜单不消失的问题

aspnet_bbs 发布于 2021-04-28 11:25, 2313 次点击
点击菜单中某一项(事件成功执行),鼠标不移开,菜单不消失,一直在网页最上层,鼠标移开了,点击的菜单才消失,正常点击后菜单不应该自动消失吗,不解,怎么解决?代码如下:


菜单:
   <style type="text/css">   
        .head-nav {
            width: 1360px;
            height: 60px;
            background: #007130;
        }
        .head-nav-con {
            width: 1360px;
            height: 60px;
            margin: auto;  
        }
        .head-nav-con ul li {
            width: 170px;
            float: left;
            font-size: 20px;
            text-align: center;
        }
        .head-nav-con ul li:hover {
            background: #ff9c01;
        }
        .head-nav-con ul a {
            display: block;
            text-decoration: none;  
            text-align: center;
            line-height: 60px;
            color: white;   
        }
        
        
   
        .head-nav-con .drop-down {
            position: relative;
        }
        .head-nav-con .drop-down-content {   
            padding: 0;
            display: none;
            position: absolute;
            z-index: 1;
            background: #007130;
        }
               
        .head-nav-con .drop-down-content li:hover > a {  
            background-color: #ff9c01;
            
        }
        .head-nav-con .drop-down:hover .drop-down-content {
            display: block;
        }
     </style>     
         

js脚本如下:
 <script type="text/javascript">
 function aa(str) {
            var mainContent = document.getElementById('IFRAME1');
         
            mainContent.src = str ;
   
        }
</script>

菜单中某一项:
   <li class="drop-down"><a href="#">基本信息</a>
                         <ul class="drop-down-content" >
                           <li><a href="javascript:void(0);"  onclick="aa('1.aspx')">录入</a></li>
                        </ul>
   </li>
3 回复
#2
apull2021-04-28 18:39
js点击里给菜单加隐藏

[此贴子已经被作者于2021-4-28 18:41编辑过]

#3
aspnet_bbs2021-04-29 09:42
回复 2楼 apull
谢谢解答,能给出代码吗?
#4
apull2021-04-29 18:49
程序代码:


 <script type="text/javascript">

 function aa(str) {
            var mainContent = document.getElementById('iframe1');         
            mainContent.src = str ;
            document.getElementById('menu').style.display="none";    //menug改成你要隐藏的菜单的id
   
        }
</script>
1