有没有点激传值后不收缩回去的JS菜单啊?只有点激第二个大类的时候第一个类才收回?急~~~~~~~`

解决方案 »

  1.   

    <html>   
        
      <head>   
      <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">   
      <meta   name="GENERATOR"   content="Microsoft   FrontPage   4.0">   
      <meta   name="ProgId"   content="FrontPage.Editor.Document">   
      <title>文件夹一</title>   
      </head>   
        
      <body>   
      <script   language="javascript">   
      NS4   =   (document.layers)   ?   1   :   0;   
      IE4   =   (document.all)   ?   1   :   0;   
      ver4   =   (NS4   ||   IE4)   ?   1   :   0;   
        
      if   (ver4)   {   
      with   (document)   {   
      write("<STYLE   TYPE='text/css'>");   
      if   (NS4)   {   
      write(".parent   {position:absolute;   visibility:visible}");   
      write(".child   {position:absolute;   visibility:visible}");   
      write(".regular   {position:absolute;   visibility:visible}")   
      }   
      else   {   
      write(".child   {display:none}")   
      }   
      write("</STYLE>");   
      }   
      }   
        
      function   getIndex(el)   {   
      ind   =   null;   
      for   (i=0;   i<document.layers.length;   i++)   {   
      whichEl   =   document.layers[i];   
      if   (whichEl.id   ==   el)   {   
      ind   =   i;   
      break;   
      }   
      }   
      return   ind;   
      }   
        
      function   arrange()   {   
      nextY   =   document.layers[firstInd].pageY   +document.layers[firstInd].document.height;   
      for   (i=firstInd+1;   i<document.layers.length;   i++)   {   
      whichEl   =   document.layers[i];   
      if   (whichEl.visibility   !=   "hide")   {   
      whichEl.pageY   =   nextY;   
      nextY   +=   whichEl.document.height;   
      }   
      }   
      }   
        
      function   initIt(){   
      if   (!ver4)   return;   
      if   (NS4)   {   
      for   (i=0;   i<document.layers.length;   i++)   {   
      whichEl   =   document.layers[i];   
      if   (whichEl.id.indexOf("Child")   !=   -1)   whichEl.visibility   =   "hide";   
      }   
      arrange();   
      }   
      else   {   
      divColl   =   document.all.tags("DIV");   
      for   (i=0;   i<divColl.length;   i++)   {   
      whichEl   =   divColl(i);   
      if   (whichEl.className   ==   "child")   whichEl.style.display   =   "none";   
      }   
      }   
      }   
        
      function   expandIt(el)   {   
      if   (!ver4)   return;   
      if   (IE4)   {   
      whichEl   =   eval(el   +   "Child");   
      if   (whichEl.style.display   ==   "none")   {   
      whichEl.style.display   =   "block";   
      }   
      else   {   
      whichEl.style.display   =   "none";   
      }   
      }   
      else   {   
      whichEl   =   eval("document."   +   el   +   "Child");   
      if   (whichEl.visibility   ==   "hide")   {   
      whichEl.visibility   =   "show";   
      }   
      else   {   
      whichEl.visibility   =   "hide";   
      }   
      arrange();   
      }   
      }   
      onload   =   initIt;   
      </script>   
      <div   id="KB1Parent"   class="parent">    <a   href="#"   onClick="expandIt('KB1');   return   false"   >文件夹一</a></div>   
      <div   id="KB1Child"   style="display:none">     <a   href="sample.htm"   target="_blank"   >页面一</a><br>   
               <a   href="sample.htm"   target="_blank"   >页面二</a><br>   
               <a   href="sample.htm"   target="_blank"   >页面三</a></div>   
      <div   id="KB2Parent"   class="parent">    <a   href="#"   onClick="expandIt('KB2');   return   false"   >文件夹二</a></div>   
      <div   id="KB2Child"   style="display:none">     <a   href="sample.htm"   target="_blank"   >页面一</a><br>   
               <a   href="sample.htm"   target="_blank"   >页面二</a><br>   
               <a   href="sample.htm"   target="_blank"   >页面三</a></div>   
      <div   id="KB3Parent"   class="parent">    <a   href="#"   onClick="expandIt('KB3');   return   false"   >文件夹三</a></div>   
      <div   id="KB3Child"   style="display:none">        <a   href="sample.htm"   target="_blank"   >页面一</a><br>   
               <a   href="sample.htm"   target="_blank"   >页面二</a><br>   
               <a   href="sample.htm"   target="_blank"   >页面三</a></div>   
      <div   id="KB4Parent"   class="parent">    <a   href="#"   onClick="expandIt('KB4');   return   false"   >文件夹四</a></div>   
      <div   id="KB4Child"   style="display:none">     <a   href="sample.htm"   target="_blank"   >页面一</a><br>   
               <a   href="sample.htm"   target="_blank"   >页面二</a><br>   
               <a   href="sample.htm"   target="_blank"   >页面三</a></div>   
      <div   id="KB5Parent"   class="parent">    <a   href="#"   onClick="expandIt('KB5');   return   false"   >文件夹五</a></div>   
      <div   id="KB5Child"   style="display:none">     <a   href="sample.htm"   target="_blank"   >页面一</a><br>   
               <a   href="sample.htm"   target="_blank"   >页面二</a><br>   
               <a   href="sample.htm"   target="_blank"   >页面三</a></div>   
      <script   language="javascript">   
      if   (NS4)   {   
      firstEl   =   "KB1Parent";   
      firstInd   =   getIndex(firstEl);   
      arrange();   
      }   
      </script>   
        
      </body>   
        
      </html>   
    就是这样啦,我要的是点第二个文件夹的时候第一个首回去,要怎么做?而且点连接不要合起来``
      

  2.   

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html;  charset=gb2312">
        <meta name="GENERATOR" content="Microsoft  FrontPage  4.0">
        <meta name="ProgId" content="FrontPage.Editor.Document">
        <title>文件夹一 </title>
    </head>
    <body>    <script language="javascript">
        var flag;  
      NS4  =  (document.layers)  ?  1  :  0;  
      IE4  =  (document.all)  ?  1  :  0;  
      ver4  =  (NS4  ||  IE4)  ?  1  :  0;  
        
      if  (ver4)  {  
      with  (document)  {  
      write(" <STYLE  TYPE='text/css'>");  
      if  (NS4)  {  
      write(".parent  {position:absolute;  visibility:visible}");  
      write(".child  {position:absolute;  visibility:visible}");  
      write(".regular  {position:absolute;  visibility:visible}")  
      }  
      else  {  
      write(".child  {display:none}")  
      }  
      write(" </STYLE>");  
      }  
      }  
        
      function  getIndex(el)  {  
      ind  =  null;  
      for  (i=0;  i <document.layers.length;  i++)  {  
      whichEl  =  document.layers[i];  
      if  (whichEl.id  ==  el)  {  
      ind  =  i;  
      break;  
      }  
      }  
      return  ind;  
      }  
        
      function  arrange()  {  
      nextY  =  document.layers[firstInd].pageY  +document.layers[firstInd].document.height;  
      for  (i=firstInd+1;  i <document.layers.length;  i++)  {  
      whichEl  =  document.layers[i];  
      if  (whichEl.visibility  !=  "hide")  {  
      whichEl.pageY  =  nextY;  
      nextY  +=  whichEl.document.height;  
      }  
      }  
      }  
        
      function  initIt(){  
      if  (!ver4)  return;  
      if  (NS4)  {  
      for  (i=0;  i <document.layers.length;  i++)  {  
      whichEl  =  document.layers[i];  
      if  (whichEl.id.indexOf("Child")  !=  -1)  whichEl.visibility  =  "hide";  
      }  
      arrange();  
      }  
      else  {  
      divColl  =  document.all.tags("DIV");  
      for  (i=0;  i <divColl.length;  i++)  {  
      whichEl  =  divColl(i);  
      if  (whichEl.className  ==  "child")  whichEl.style.display  =  "none";  
      }  
      }  
      }  
        
      function  expandIt(el)
      {  
        if  (!ver4)  return;  
        if  (IE4)
        {
            whichEl  =  eval(el  +  "Child");  
            if(whichEl.style.display  ==  "none")
            {  
                if(flag!=null)
                {
                    flag.style.display = "none";
                }
                whichEl.style.display  =  "block";  
            }  
            else
            {  
                if(flag!=null)
                {
                    flag.style.display = "none";
                }    
                whichEl.style.display  =  "none";  
            }
            flag = whichEl; 
        }  
        else
        {  
            whichEl  =  eval("document."  +  el  +  "Child");  
            if(whichEl.visibility  ==  "hide")
            {  
                if(flag!=null)
                {
                    flag.style.visibility = "hide";
                }
                whichEl.visibility  =  "show";  
            }  
            else
            {  
                if(flag!=null)
                {
                    flag.style.visibility = "hide";
                }
                whichEl.visibility  =  "hide";  
            }
            flag = whichEl;
            arrange();  
        }  
      }
        
      onload  =  initIt;  
        </script>    <div id="KB1Parent" class="parent">
            <a href="#" onclick="expandIt('KB1');  return  false">文件夹一 </a>
        </div>
        <div id="KB1Child" style="display: none">
            <a href="sample.htm" target="_blank">页面一 </a>
            <br>
            <a href="sample.htm" target="_blank">页面二 </a>
            <br>
            <a href="sample.htm" target="_blank">页面三 </a>
        </div>
        <div id="KB2Parent" class="parent">
            <a href="#" onclick="expandIt('KB2');  return  false">文件夹二 </a>
        </div>
        <div id="KB2Child" style="display: none">
            <a href="sample.htm" target="_blank">页面一 </a>
            <br>
            <a href="sample.htm" target="_blank">页面二 </a>
            <br>
            <a href="sample.htm" target="_blank">页面三 </a>
        </div>
        <div id="KB3Parent" class="parent">
            <a href="#" onclick="expandIt('KB3');  return  false">文件夹三 </a>
        </div>
        <div id="KB3Child" style="display: none">
            <a href="sample.htm" target="_blank">页面一 </a>
            <br>
            <a href="sample.htm" target="_blank">页面二 </a>
            <br>
            <a href="sample.htm" target="_blank">页面三 </a>
        </div>
        <div id="KB4Parent" class="parent">
            <a href="#" onclick="expandIt('KB4');  return  false">文件夹四 </a>
        </div>
        <div id="KB4Child" style="display: none">
            <a href="sample.htm" target="_blank">页面一 </a>
            <br>
            <a href="sample.htm" target="_blank">页面二 </a>
            <br>
            <a href="sample.htm" target="_blank">页面三 </a>
        </div>
        <div id="KB5Parent" class="parent">
            <a href="#" onclick="expandIt('KB5');  return  false">文件夹五 </a>
        </div>
        <div id="KB5Child" style="display: none">
            <a href="sample.htm" target="_blank">页面一 </a>
            <br>
            <a href="sample.htm" target="_blank">页面二 </a>
            <br>
            <a href="sample.htm" target="_blank">页面三 </a>
        </div>    <script language="javascript">  
      if  (NS4)  {  
      firstEl  =  "KB1Parent";  
      firstInd  =  getIndex(firstEl);  
      arrange();  
      }  
        </script></body>
    </html>
      

  3.   

    你可以看看这个链接:http://bolm.cn/designonline/popmenu/popmenu2.html
    这个菜单做得不错