简体   繁体   English

菜单崩溃的javascript在IE8中不起作用

[英]menu collapsing javascript not working in IE8

I am using a menu collapsing javascript in my wesite in which when i click in the title called member the list of members must be shown down the member as accordion.In firefox and chrome it is working quite well but when i tested with IE8 all the members are showing before clicking the member title.Can some one help me is this a browser compatibility issue or something else.Hope i will get the answer soon. 我在我的网站中使用了一个折叠式JavaScript菜单,在其中单击标题为member的标题时,必须将成员列表显示为手风琴。在firefox和chrome中,它运行良好,但是当我使用IE8测试时,成员在单击成员标题之前就已显示。有人可以帮我这是浏览器兼容性问题还是其他问题。希望我能尽快得到答案。

This is the function which is in the js page. 这是js页面中的函数。 //menu-collapsed.js //menu-collapsed.js

<script type="text/javascript">
function initMenu() {
  $('#menu ul').hide();
  $('#menu li a').click(
    function() {
        $(this).next().slideToggle('normal');   
      }
    );
  }
$(document).ready(function() {initMenu();});
</script>

and the html page is: html页面是:

<html>
<head>
<script src="includes/jquery-1.2.1.min.js" type="text/javascript"></script>
<script src="includes/menu-collapsed.js" type="text/javascript"></script>
 <script type="text/javascript">
//<![CDATA[
var page={};

$(function() {
new FrontPage().init();
});

//]]>
</script>
</head>
<body>
<ul id="menu">  
    <li>
    <?php
        $mvo=new menuVO();
        $mdao=new menuDAO();
        $menus=$mdao->fetchAll('onlypublished');
            foreach($menus as $menu)
            {
                if($menu->menu_type=='Member')
                {
                    echo "<a href=\"#\">$menu->name</a>"; 
                }
            }


        $mvo=new membersVO();
        $mdao=new membersDAO();
        $list=$mdao->fetchAll('onlypublished');
        echo "<ul>";    
            foreach($list as $members)
            {
                echo "<li><span><a href=\"$members->url\">$members->name</a></span></li>";
            }
        echo "</ul>";   
    ?>
        </li>
</ul>
</body>
</html>

Put up your code. 输入您的代码。 You may also find your answer trying to learn how to make one. 您可能还会找到尝试学习如何制作答案的答案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM