<SCRIPT language=Javascript>
 //显示下拉菜单
 function ShowsList2(strid)
{
 for (var i=0;i<MenuList.length;i++ )
 {
     if(i!=strid)
 {
       MenuList(i).style.display="none";
   MenuImg(i).src="images/2/left_02.gif";
 }
 else
 {
   if(MenuList(i).style.display=="none")
 {
 MenuList(i).style.display=""
  MenuImg(strid).src="images/2/left_03.gif";
 }
 else
 {
 MenuList(i).style.display="none";
  MenuImg(i).src="images/2/left_02.gif";
 }
    }
   }
}</SCRIPT>
.............
<TD width="82%" height=25>
<A  title=加入 style="CURSOR: hand" onclick=" ShowsList2(0);"target=right class=w18>信息</A></TD>
     </TR>
        <TR id=MenuList style="DISPLAY: none;">
        <TD colSpan=2>
      <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
        <TBODY>
         <TR>
<TD width=15></TD>
<TD height=22><IMG height=10 src=images/2/left_03.gif width=9></TD>
<TD class=w16><A href="11.asp" target=right>信息修改</A></TD>
  </TR>
</TBODY></TABLE></TD>
................以上在IE中正常,在Firefox上点击显示不了下拉菜单请了解的朋友帮忙一下,十分感谢。

解决方案 »

  1.   

    问题不是出在style.display上,而是MenuList的这个上面,在FF中ID是唯一的
    并且不能直接MenuList.length这样使用
      

  2.   

    可以使用
    <div id="div1">
    <table>
    <tr id="MenuList1">... ...
    </tr>
    <tr id="MenuList2">... ...
    </tr>
    <tr id="MenuList3">... ...
    </tr>
    </div>
    <script language=javascript>
       var objs=document.getElementById("div1").getElementsByTagName("tr')
       for(var i=0;i<objs.length;i++)
       {
           if(/^MenuList/.test(objs[i].id)){
                   //这里写代码
           }
        }
    </script>
      

  3.   

    用CSS比较容易解决<style>
    .show{display:block}
    .hide{display:none}
    </style>
    <table border=1 id="t" class="show">
    <tr>
      <td>1</td>
      <td>1</td>
      <td>1</td>
    </tr>
    </table>
    <input type=button value=" change " onclick="changeMe()">
    <script>
    function changeMe(){
        var oTable = document.getElementById("t");
        if(oTable.className == "show")
            oTable.className = "hide";
        else
            oTable.className = "show";
    }
    </script>
      

  4.   

    试了不行,改不了,不知道哪位朋友能帮整个修改一下。谢谢<HTML><HEAD><TITLE>管理工具</TITLE>
    <SCRIPT language=Javascript>
     //显示下拉菜单
     function ShowsList2(strid)
    {   
     for (var i=0;i<MenuList.length;i++ )
     {
         if(i!=strid)
     {
           MenuList(i).style.display="none";
       MenuImg(i).src="images/2/left_02.gif";
     }
     else
     {
       if(MenuList(i).style.display=="none")
     {
     MenuList(i).style.display=""
      MenuImg(strid).src="images/2/left_03.gif";
     }
     else
     {
     MenuList(i).style.display="none";
      MenuImg(i).src="images/2/left_02.gif";
     }
        }
       }
    }</SCRIPT>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <LINK href=images/2/style.css type=text/css rel=stylesheet>
    <META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
    <BODY>
    <TABLE cellSpacing=0 cellPadding=0 width="94%" align=center border=0>
      <TBODY>
        <TR>
          <TD width="18%"><DIV align=center><IMG height=10 src=images/2/left_02.gif width=9  name=MenuImg></DIV></TD>
          <TD width="82%" height=25><A  title=加入 style="CURSOR: hand" onclick=" ShowsList2(0);" target=right class=w18>信息</A></TD>
        </TR>
        <TR id=MenuList style="DISPLAY: none;">
          <TD colSpan=2><TABLE cellSpacing=0 cellPadding=0 width="100%" 
                                  border=0>
              <TBODY>
                <TR>
                  <TD width=15></TD>
                  <TD height=22><IMG height=10 src=images/2/left_03.gif width=9></TD>
                  <TD class=w16><A href="11.asp" target=right>信息修改</A></TD>
                </TR>
              </TBODY>
          </TABLE></TD>
        </TR>
        <TR>
          <TD colSpan=2 height=1 class=td5></TD>
        </TR>
        <TR>
          <TD width="18%"><DIV align=center><IMG height=10 src=images/2/left_02.gif width=9 name=MenuImg></DIV></TD>
          <TD width="82%" height=25><STRONG><A class=w18 title=管理 style="CURSOR: hand" onclick=" ShowsList2(1);" target=right>管理</A></STRONG></TD>
        </TR>
        <TR id=MenuList style="DISPLAY: none;">
          <TD colSpan=2><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
              <TBODY>
                <TR>
                  <TD width="15"></TD>
                  <TD height=22><IMG height=10 src=images/2/left_03.gif width=9></TD>
                  <TD class=w16><A href="11.asp" target=right>信息修改</A></TD>
                </TR>
              </TBODY>
          </TABLE></TD>
        </TR>
      </TBODY>
    </TABLE>
    </BODY>
    </HTML>
      

  5.   

    <HTML><HEAD><TITLE>管理工具</TITLE>
    <SCRIPT language=Javascript>
     //显示下拉菜单
     function ShowsList2(strid)
    {   
         var menuList = document.getElementsByName("menuName");
     for (var i=0;i<menuList.length;i++ )
     {
         if(i!=strid)
     {
           menuList[i].style.display="none";
      // MenuImg(i).src="images/2/left_02.gif";
     }
     else
     {
       if(menuList[i].style.display=="none")
     {
     menuList[i].style.display=""
    //  MenuImg(strid).src="images/2/left_03.gif";
     }
     else
     {
     menuList[i].style.display="none";
    //  MenuImg[i].src="images/2/left_02.gif";
     }
        }
       }
    }</SCRIPT>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <LINK href=images/2/style.css type=text/css rel=stylesheet>
    <META content="MSHTML 6.00.2900.2873" name=GENERATOR></HEAD>
    <BODY>
    <TABLE cellSpacing=0 cellPadding=0 width="94%" align=center border=0>
      <TBODY>
        <TR>
          <TD width="18%"><DIV align=center><IMG height=10 src=images/2/left_02.gif width=9  name=MenuImg></DIV></TD>
          <TD width="82%" height=25><A  title=加入 style="CURSOR: hand" onclick=" ShowsList2(0);" target=right class=w18>信息</A></TD>
        </TR>
        <TR id=MenuList name="menuName" style="DISPLAY: none;">
          <TD colSpan=2><TABLE cellSpacing=0 cellPadding=0 width="100%" 
                                  border=0>
              <TBODY>
                <TR>
                  <TD width=15></TD>
                  <TD height=22><IMG height=10 src=images/2/left_03.gif width=9></TD>
                  <TD class=w16><A href="11.asp" target=right>信息修改</A></TD>
                </TR>
              </TBODY>
          </TABLE></TD>
        </TR>
        <TR>
          <TD colSpan=2 height=1 class=td5></TD>
        </TR>
        <TR>
          <TD width="18%"><DIV align=center><IMG height=10 src=images/2/left_02.gif width=9 name=MenuImg></DIV></TD>
          <TD width="82%" height=25><STRONG><A class=w18 title=管理 style="CURSOR: hand" onclick=" ShowsList2(1);" target=right>管理</A></STRONG></TD>
        </TR> 
        <TR id=MenuList name="menuName" style="DISPLAY: none;">
          <TD colSpan=2><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
              <TBODY>
                <TR>
                  <TD width="15"></TD>
                  <TD height=22><IMG height=10 src=images/2/left_03.gif width=9></TD>
                  <TD class=w16><A href="11.asp" target=right>信息修改</A></TD>
                </TR>
              </TBODY>
          </TABLE></TD>
        </TR>
      </TBODY>
    </TABLE>
    </BODY>
    </HTML>
      

  6.   

    上面的朋友,您好,这个在Firefox上可以啦,但在IE上又不行啦