标题:急!点击菜单后菜单不消失的问题
只看楼主
aspnet_bbs
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2021-4-28
结帖率:0
已结贴  问题点数:20 回复次数:3 
急!点击菜单后菜单不消失的问题
点击菜单中某一项(事件成功执行),鼠标不移开,菜单不消失,一直在网页最上层,鼠标移开了,点击的菜单才消失,正常点击后菜单不应该自动消失吗,不解,怎么解决?代码如下:


菜单:
   <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>
搜索更多相关主题的帖子: background 消失 display 菜单 点击 
2021-04-28 11:25
apull
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:三体星系
等 级:版主
威 望:185
帖 子:1404
专家分:8479
注 册:2010-3-16
得分:20 
js点击里给菜单加隐藏

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

2021-04-28 18:39
aspnet_bbs
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2021-4-28
得分:0 
回复 2楼 apull
谢谢解答,能给出代码吗?
2021-04-29 09:42
apull
Rank: 16Rank: 16Rank: 16Rank: 16
来 自:三体星系
等 级:版主
威 望:185
帖 子:1404
专家分:8479
注 册:2010-3-16
得分:0 
程序代码:

 <script type="text/javascript">

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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-505602-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.053579 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved