Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 回发后再次隐藏Jquery.show_C#_Jquery_Asp.net_Html Lists - Fatal编程技术网

C# 回发后再次隐藏Jquery.show

C# 回发后再次隐藏Jquery.show,c#,jquery,asp.net,html-lists,C#,Jquery,Asp.net,Html Lists,我有一个UL,我用隐藏和显示控制。问题是,当我点击level1时,它只显示level2片刻,然后它就消失了,我相信这是因为回发或其他原因。这项功能可以正常工作,但却无法保持原样。我需要能够切换列表中的项目以显示和隐藏它们 <script> $(function(){ $('.level2').hide(); $('.level3').hide(); $('.level1').click(function

我有一个UL,我用隐藏和显示控制。问题是,当我点击level1时,它只显示level2片刻,然后它就消失了,我相信这是因为回发或其他原因。这项功能可以正常工作,但却无法保持原样。我需要能够切换列表中的项目以显示和隐藏它们

     <script>
      $(function(){
          $('.level2').hide();
          $('.level3').hide();
          $('.level1').click(function () {
              $('.level2').show();
                return false;
              $('level2').click(function () {
                  $('.level3').show();
                    return false;
                  $(this).find('ul').slideToggle();
              });
          })
      }
)
  </script>

$(函数(){
$('.level2').hide();
$('.level3').hide();
$('.level1')。单击(函数(){
$('.level2').show();
返回false;
$('level2')。单击(函数(){
$('.level3').show();
返回false;
$(this.find('ul').slideToggle();
});
})
}
)
HTML:


函数openNewWin(url){
var x=window.open(url,'mynewwin','toolbar=no,directories=no,location=no,menubar=no,left=0,top=0,resizeable=no,status=no');
x、 焦点();
}
$(函数(){
$('.level2').hide();
$('.level3').hide();
$('.level1')。单击(函数(){
$('.level2').show();
返回false;
$('level2')。单击(函数(){
$('.level3').show();
返回false;
$(this.find('ul').slideToggle();
});
})
}
)

您也可以共享html吗?这些锚定是否具有href属性?不要在另一个锚定中添加事件侦听器。在添加
level2
单击处理程序之前,您还有
return
语句。我添加了HTMLNo,您添加了ASP.Net控件。添加HTML,我们不知道这些控件的结果是什么。
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>
    <title></title>
    <link href="styles/Menu.css" rel="stylesheet" />

        <script type="text/javascript">

            function openNewWin(url) {

                var x = window.open(url, 'mynewwin', 'toolbar=no,directories=no,location=no,menubar=no,left=0,top=0,resizable=no,status=no');

                x.focus();

            }



    </script>

  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css"/>
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css"/>

  <script>
      $(function(){
          $('.level2').hide();
          $('.level3').hide();
          $('.level1').click(function () {
              $('.level2').show();
                return false;
              $('level2').click(function () {
                  $('.level3').show();
                    return false;
                  $(this).find('ul').slideToggle();
              });
          })
      }
)
  </script>

</head>
<body>
    <form id="form1" runat="server">
    <div id="menu" class="MenuBar">
<asp:Menu ID="Menu1" runat="server" CssClass="mainmenu" StaticDisplayLevels="3" Target="_blank" StaticEnableDefaultPopOutImage="False" StaticSubMenuIndent="0px" >
      <LevelMenuItemStyles>
    <asp:MenuItemStyle CssClass="level1"/>
    <asp:MenuItemStyle CssClass="level2"/>
    <asp:MenuItemStyle CssClass="level3" />
    <asp:MenuItemStyle CssClass="level4" />

  </LevelMenuItemStyles>

    <StaticMenuItemStyle CssClass="staticItem" />
        </asp:Menu>

</div>

    </form>

</body>
</html>