CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Web 开发 >  ASP

产品大类分小类下的小类动态显示

楼主yaofen(抵制日货)2005-01-28 09:53:59 在 Web 开发 / ASP 提问

我做个产品发布里有产品分大类和小类,在显示页的左侧导航里现在的显示效果是:第一次打开,只显示大类名称,点击某大类后,所有小类都显示出来,主要是用大循环套小循环完成的,下面是负责显示的代码,我想要那种,点击某个大类只显示对应大类下的小类名称,其他仍然只显示大类名称的效果,高手知道怎么实现吗?请指教!多谢  
  <%  
  dim   rs1,sql1  
  set   rs1=server.CreateObject("adodb.recordset")  
  sql1="select   category,categoryid   from   bclass   order   by   categoryid   asc"  
  rs1.open   sql1,cn,1,1  
  if   not   rs1.eof   then  
  do   while   not   rs1.eof  
  %>  
  <tr>  
  <td   width="135"><a   href="cp.asp?categoryid=<%=rs1("categoryid")%>","_self">  
  <div   align="center"><font   color="#FF0000"><%=rs1("category")%></font></div></a></td></tr>  
  <%  
  if   Request("categoryid")<>""   then  
  dim   rs2,sql2  
  set   rs2=server.CreateObject("adodb.recordset")  
  sql2="select   *   from   sclass   where   categoryid="&rs1("categoryid")&"   order   by   categoryid   asc"  
  rs2.open   sql2,cn,1,1  
  if   not   rs2.eof   then  
  do   while   not   rs2.eof  
  %>  
  <tr>  
  <td   width="135"><a   href="cp.asp?sortsid=<%=rs2("sortsid")%>&categoryid=<%=rs("categoryid")%>","_self">  
  <div   align="center"><%=rs2("sorts")%><br>  
  </div>  
    </a></td>  
  </tr>  
    <%  
  rs2.movenext  
  loop  
  end   if  
  rs2.close  
  set   rs2=nothing  
  end   if  
  %>  
  <%  
  rs1.movenext  
  loop  
  end   if  
  rs1.close  
  set   rs1=nothing  
  %> 问题点数:50、回复次数:15Top

1 楼mymyal123(风之森)回复于 2005-01-28 09:58:48 得分 0

用树型目录,搜一下,很多Top

2 楼qfacy(两袖清风)回复于 2005-01-28 09:59:07 得分 0

二级连动,你搜索下有很多这样的代码!太多了!Top

3 楼yaofen(抵制日货)回复于 2005-01-28 10:28:17 得分 0

我搜了一下树形目录和二级连动,资料不多,并且很多我都看不懂,好像都是下拉菜单式的,不太好理解,我还是不知道要直接显示应该怎么做,高手帮忙,最好有类似的代码看下,多谢!Top

4 楼rwj(无聊男孩)回复于 2005-01-28 10:40:57 得分 0

我自己是写了一个。写得太乱了。不敢拿出来。  
  这个你看看。  
   
  主文件:  
  <!--#include   file="dbconn.asp"-->  
  <html>  
  <head>  
  <title>prj</title>  
  <link   rel="stylesheet"   href="enpt.css"   type="text/css">  
   
  <script   src="outline.js"   language="JavaScript"></script>  
  <script   language="JavaScript">  
  //   Declare   global   variables  
  var   theMenu   =   new   Menu;  
  var   theBrowser   =   new   browserInfo;  
  var   imgStore   =   new   imgStoreObject;  
  var   statusTimeout   =   0;  
  window.defaultStatus   =   "";  
  function   initialise()   {  
  //   Set   up   some   options  
        theMenu.name="theMenu";  
        theMenu.autoScrolling   =   true;  
        theMenu.modalFolders   =   false;  
        theMenu.linkOnExpand   =   false;  
        theMenu.toggleOnLink   =   false;  
        theMenu.menuTop   =   10;  
        theMenu.entryHeight   =   16;  
        initOutlineIcons();  
   
        var   level1ID=-1;  
  <%  
  '赋初值  
  enptsnm=""  
  lenptsnm=0  
  sql="select   SysNumber,   Name   from   project   order   by   SysNumber   ASC"  
   
  set   rs=conn.execute(sql)  
      if   rs.eof   then  
            response.write("<p>&nbsp;</p><p>&nbsp;</p><p   align='center'>尚无任何项目,请先添加!<p   align='center'><a   href='itemadd.asp'   targte='right'>添加项目</a>")  
            response.end  
      end   if  
   
  do   while   not   rs.eof    
      l   =len(rs("SysNumber"))  
   
            if   l   =   0   then  
                  ls_add   =   "addMenu"  
                  ls_parent   =   "level1ID"  
            else  
                  ls_add   =   "addChild"  
                  ls_parent   =   left(rs("SysNumber"),l   -   4   )  
                  ls_parent   =   "level"   &   ls_parent  
            end   if  
       
      na=replace(rs("name"),vbCrLf,"")  
       
      ls_name   =   "<a   href='itemin.asp?snm="   +   rs("SysNumber")   +   "'   target='right'   title='详情'>"   +     na   +   "</a>"  
   
      ls_radio   =   ""  
  %>  
  level<%=rs("SysNumber")%>   =   theMenu.<%=ls_add%>(<%=ls_parent%>,   "Folder",   "<%=ls_radio%><%=ls_name%>",   "",   "",   "main","");  
  <%  
      rs.movenext  
  loop  
  rs.close  
  set   rs=nothing  
  %>  
  }  
  //-->  
  </script>  
   
  <style   TYPE="text/css">  
  <!--  
    .menuItem   {position:absolute;   left:0px;   visibility:hidden;font-family:   "宋体";font-size:   9pt;text-decoration-underline:   off;}  
    .node   {   color:   black   ;font-weight:   bold}  
    .node   A:link   {   color:   black   ;font-weight:   bold}  
    .node   A:visited   {   color:   black   ;font-weight:   bold}  
    .node   A:active   {   color:   red   ;font-weight:   bold}  
    .leaf   {   color:   black   ;font-weight:   bold}  
    .leaf   A:link   {   color:   black   ;font-weight:   bold}  
    .leaf   A:visited   {   color:   black   ;font-weight:   bold}  
    .leaf   A:active   {   color:   red   ;font-weight:   bold}  
  -->  
  </style>  
  <meta   http-equiv="Content-Type"   content="text/html;   charset=gb2312">  
  </head>  
   
  <body   background="../images/leftbg.gif"   text="#000000"   leftmargin="0"   topmargin="0"   marginwidth="0"   marginheight="0">  
  <p>&nbsp;</p>  
  <script   LANGUAGE="JavaScript">  
  <!--  
    initialise();  
  theMenu.draw();  
    //-->  
  </script>  
  </body>  
  </html>Top

5 楼rwj(无聊男孩)回复于 2005-01-28 10:42:05 得分 0

这个是outline.js  
   
  <!--  
  function   divObject(obj)   {  
  this.style   =   obj;  
  this.document   =   obj.document;  
  }  
  function   simpleArray()   {  
  this.item   =   0;  
  }  
  function   imgStoreItem(theName,   theSrc,   w,   h)   {  
  this.name   =   theName;  
  this.src   =   theSrc;  
  this.obj   =   null;  
  this.w   =   w;  
  this.h   =   h;  
  if   (theBrowser.canCache)   {  
  this.obj   =   new   Image(18,   16);  
  this.obj.src   =   theSrc;  
  }  
  }  
  function   imgStoreObject()   {  
  this.count   =   -1;  
  this.img   =   new   imgStoreItem;  
  this.find   =   imgStoreFind;  
  this.add   =   imgStoreAdd;  
  this.getSrc   =   imgStoreGetSrc;  
  this.getTag   =   imgStoreGetTag;  
  }  
  function   imgStoreFind(theName)   {  
  var   foundItem   =   -1;  
  for   (var   i   =   0;   i   <=   this.count;   i++)   {  
  if   (this.img[i].name   ==   theName)   {  
  foundItem   =   i;  
  break;  
  }  
  }  
  return   foundItem;  
  }  
  function   imgStoreAdd(theName,   theSrc,   w,   h)   {  
  if   (theSrc)   {  
  var   i   =   this.find(theName);  
  if   (i   ==   -1)   {  
  this.img[++this.count]   =   new   imgStoreItem(theName,   theSrc,   w,   h);  
  }   else   {  
  this.img[i].name   =   theName;  
  this.img[i].src   =   theSrc;  
  this.img[i].w   =   w;  
  this.img[i].h   =   h;  
  }  
  }  
  }  
  function   imgStoreGetSrc(theName)   {  
  var   i   =   this.find(theName);  
  return   (i   ==   -1)   ?   ''   :   this.img[i].src;  
  }  
  function   imgStoreGetTag(theName,   iconID)   {  
  var   i   =   this.find(theName);  
  var   Found   =   '';  
  if   (i   >=   0)   {  
  with   (this.img[i])   {  
  if   (src   !=   '')   {  
  Found   =   '<img   src='   +   '"'   +   src   +     '"   width='   +   w   +   '   height='   +   h   +   '   border=0   align="top"';  
  if   (iconID   !=   '')   {  
  Found   +=   '   name="'   +   iconID   +   '"   ';  
  }  
  }  
  }  
  Found   +=   '>';  
  }  
  return   Found;  
  }  
  //   The   MenuItem   object.     This   contains   the   data   and   functions   for   drawing   each   item.  
  function   MenuItem   (id,   type,   text,   url,   status,   target,   onclickfunc,   item,   parent)   {  
  this.id   =   id;  
  this.type   =   type;  
  this.text   =   text;  
  this.url   =   url;  
  this.status   =   status;  
  this.target   =   target;                       //   "text";  
  this.onClickFunc   =   onclickfunc;   //   "";  
  this.nextItem   =   item;  
  this.FirstChild   =   -1;  
  this.parent   =   parent;  
  this.isopen   =   false;                         //   展开  
  this.isSelected   =   false;  
  this.divObj   =   null;  
  this.spanObj   =   null;  
  this.draw   =   DrawItem;  
  this.PMIconName   =   getPMIconName;  
  this.setImg   =   setImage;  
  this.setIsOpen   =   SetIsOpen;  
  this.setSelected   =   SetSelected;  
  this.mouseOver   =   mouseOver;  
  this.mouseOut   =   mouseOut;  
  }  
   
  function   DrawItem   (indentStr,nowMenu)   {  
                  var   tmp   =   '="return   '+nowMenu.name+'.entry['   +   this.id   +   '].';  
  var   iconTag   =   imgStore.getTag(this.PMIconName(),   'plusMinusIcon'   +   this.id);  
  var   aLine   =   '<nobr>'   +   indentStr;  
  if   (this.FirstChild   !=   -1)   {  
                                  aLine   +=   '<A   HREF="javascript:'+nowMenu.name+'.toggle('   +   this.id   +   ')"   name="plusMinus'   +   this.id   +   '"   ';  
  aLine   +=   'onMouseOver'   +   tmp   +   'mouseOver(\'plusMinusIcon\');"   ';  
  aLine   +=   'onMouseOut'   +   tmp   +   'mouseOut(\'plusMinusIcon\');">'   +   iconTag   +   '</A>';  
  }   else   {  
  aLine   +=   iconTag;  
  }  
  var   imgName   =   this.type   +   ((this.isSelected)   ?   'Selected'   :   '');  
  if   (imgStore.getSrc(imgName)   ==   '')   {imgName   =   this.type;}  
  var   theEntry   =   imgStore.getTag(imgName,   'docIcon'   +   this.id)   +   this.text;  
  aLine   +=   '<SPAN   CLASS="'   +   ((this.FirstChild   !=   -1)   ?   'node'   :   'leaf')   +   '">'  
  if   ((this.url   !=   '')   ||   (nowMenu.wizardInstalled))   {  
  /* aLine   +=   '<A   HREF="';  
  aLine   +=   (nowMenu.wizardInstalled)   ?   'javascript:void(0)"'   :   (this.url   +   '"   TARGET="'   +   this.target   +'"   ');  
                                  aLine   +=   'onClick="'+nowMenu.name+'.itemClicked('   +   this.id   +   ');';  
                                  aLine   +=   (this.onClickFunc   !=   '')   ?   this.onClickFunc   +   ';"   '   :   '"   ';  
  aLine   +=   'onMouseOver'   +   tmp   +   'mouseOver(\'docIcon\');"   ';  
  aLine   +=   'onMouseOut'   +   tmp   +   'mouseOut(\'docIcon\');">'   +   theEntry   +   '</A>';   */  
  aLine   +=   theEntry;  
  }   else   {  
  aLine   +=   theEntry;  
  }  
  aLine   +=   '</SPAN></nobr><BR>';  
  return   aLine;  
  }  
  function   getPMIconName()   {  
  var   iconName   =   'icon'   +   ((this.FirstChild   !=   -1)   ?   ((this.isopen   ==   true)   ?   'Minus'   :   'Plus')   :   'Join');  
  iconName   +=   (this.id   ==   0)   ?   ((this.nextItem   ==   -1)   ?   'Only'   :   'Top')   :   ((this.nextItem   ==   -1)   ?   'Bottom'   :   '');  
  return   iconName;  
  }  
  function   setImage(imgID,   imgName)   {  
  var   imgSrc   =   imgStore.getSrc(imgName);  
  if   (imgSrc   !=   '')   {  
  if   (theBrowser.hasDHTML)   {  
  if   (this.divObj)   {   this.divObj.document.images[imgID].src   =   imgSrc;   }  
  }   else   {  
  if   (theBrowser.canCache)   {  
                                                                  if   (document.images[imgID])   {  
                                                                        document.images[imgID].src   =   imgSrc;  
                                                                  }  
  }  
  }  
  }  
  }  
  function   SetIsOpen   (isOpen)   {  
  if   (this.isopen   !=   isOpen)   {  
  this.isopen   =   isOpen;  
  this.setImg('plusMinusIcon'   +   this.id,   this.PMIconName());  
  return   true;  
  }   else   {   return   false;   }  
  }  
  function   SetSelected   (isSelected)   {  
  this.isSelected   =   isSelected;  
  this.setImg('docIcon'   +   this.id,   this.type   +   ((isSelected)   ?   'Selected'   :   ''));  
  }  
  function   mouseOver(imgName)   {  
                  status   =   '';     //Needed   for   setStatus   to   work   on   MSIE   3   -   Go   figure!?  
  var   newImg   =   '';  
  if   (imgName   ==   'plusMinusIcon')   {  
  newImg   =   this.PMIconName();  
  setStatus('Click   to   '   +   ((this.isopen   ==   true)   ?   'collapse.'   :   'expand.'));  
  }   else   {  
  if   (imgName   ==   'docIcon')   {  
  newImg   =   this.type   +   ((this.isSelected)   ?   'Selected'   :   '');  
  setStatus(this.status);  
  }  
  }  
  if   (theBrowser.canOnMouseOut)   {   this.setImg(imgName   +   this.id,   newImg   +   'MouseOver');   }  
  return   true;  
  }  
  function   mouseOut(imgName)   {  
  clearStatus();  
  var   newImg   =   '';  
  if   (imgName   ==   'plusMinusIcon')   {  
  newImg   =   this.PMIconName();  
  }   else   {  
  if   (imgName   ==   'docIcon')   {  
  var   imgSrc   =   imgStore.getSrc(imgName);  
  newImg   =   this.type   +   ((this.isSelected)   ?   'Selected'   :   '');  
  if   (imgStore.getSrc(newImg)   ==   '')   {   newImg   =   this.type;   }  
  }  
  }  
  if   (theBrowser.canOnMouseOut)   {   this.setImg(imgName   +   this.id,   newImg);   }  
  return   true;  
  }  
  //   The   Menu   object.     This   is   basically   an   array   object   although   the   data   in   it   is   a   tree.  
  function   Menu   ()   {  
                  this.name="";  
  this.count   =   -1;  
  this.autoScrolling   =   false;  
  this.modalFolders   =   false;  
  this.linkOnExpand   =   false;  
  this.toggleOnLink   =   false;  
  this.lastPMClicked   =   -1;  
  this.selectedEntry   =   -1;  
  this.menuTop   =   10;  
  this.entryHeight   =   16;  
  this.wizardInstalled   =   false;  
  this.entry   =   new   MenuItem;  
  this.addMenu   =   AddMenu;  
  this.addChild   =   AddChild;  
  this.draw   =   MenuDraw;  
  this.drawALevel   =   DrawALevel;  
  this.refresh   =   refreshMenu;  
  this.reload   =   reloadMenu;  
  this.refreshDHTML   =   refreshMenuDHTML;  
  this.itemClicked   =   itemClicked;  
  this.setEntry   =   setEntry;  
  this.setEntryByURL   =   setEntryByURL;  
  this.setAll   =   setAll;  
  this.openAll   =   openAll;  
  this.closeAll   =   closeAll;  
  this.findEntry   =   findEntry;  
  this.toggle   =   toggle;  
  }  
   
  function   AddMenu   (addTo,   type,   text,   url,   status,   target,   onclickfunc)   {  
  var   theNI   =   -1;  
  var   theP   =   -1;  
  if   ((url   ==   '')   &&   (theBrowser.canJSVoid))   {url   =   'javascript:void(0);';}  
  if   (addTo   ==   -1)   {   addTo   =   this.count;   }  
   
  if   (this.count++   !=   -1)   {  
  theNI   =   this.entry[addTo].nextItem;  
  theP   =   this.entry[addTo].parent;  
  this.entry[addTo].nextItem   =   this.count;  
  }  
  this.entry[this.count]   =   new   MenuItem(this.count,   type,   text,   url,   status,   target,   onclickfunc,   theNI,   theP);  
  return   this.count;  
  }  
  function   AddChild   (addTo,   type,   text,   url,   status,   target,   onclickfunc)   {  
  if   ((url   ==   '')   &&   (theBrowser.canJSVoid))   {url   =   'javascript:void(0);';}  
  if   (this.count   ==   -1)   {  
  this.addMenu   (addTo,   type,   text,   url,   status,target);  
  }   else   {  
  if   (addTo   <   0)   {   addTo   =   this.count;   }  
  var   childID   =   this.entry[addTo].FirstChild;  
  if   (childID   <   0)   {  
  this.count++;  
  this.entry[this.count]   =   new   MenuItem(this.count,   type,   text,   url,   status,   target,   onclickfunc,   -1,   addTo);  
  this.entry[addTo].FirstChild   =   this.count;  
  }   else   {  
  while   (this.entry[childID].nextItem   !=   -1)   {  
  childID   =   this.entry[childID].nextItem;  
  }  
  this.addMenu   (childID,   type,   text,   url,   status,target,onclickfunc);  
  }  
  }  
  return   this.count;  
  }  
  Top

6 楼rwj(无聊男孩)回复于 2005-01-28 10:42:36 得分 0

接上面的。  
  function   MenuDraw()   {  
  this.drawALevel(0,   '',   true);  
  if   (theBrowser.hasDHTML)   {  
  this.refreshDHTML();  
  }   else   {  
  if   ((this.lastPMClicked   >   0)   &&   theBrowser.mustMoveAfterLoad)   {  
                                                  location   =   location.pathname   +   '#plusMinus'   +   this.lastPMClicked;  
  this.lastPMClicked   =   0;  
  }  
  }  
  }  
  function   DrawALevel(firstItem,   indentStr,   isVisible)   {  
  var   currEntry   =   firstItem;  
  var   tempStr   =   "";  
  var   aLine   =   "";  
  var   e   =   null;  
  while   (currEntry   >   -1)   {  
  e   =   this.entry[currEntry];  
  aLine   =   e.draw(indentStr,this);  
  if   (theBrowser.hasDHTML)   {  
  var   menuBottom   =   (this.count   *   this.entryHeight)   +   this.menuTop;  
  var   divName   =   'entryDIV'   +   currEntry  
  var   spanName   =   'entrySPAN'   +   currEntry  
  aLine   =   '<DIV   ID="'   +   divName   +   '"   CLASS="menuItem">'   +   aLine   +   '</DIV>';  
                                                  document.writeln   (aLine);                                                  
  if   (theBrowser.code   ==   "MSIE")   {  
                                                                  e.divObj   =   document.all[divName];  
  }   else   {  
                                                                  e.divObj   =   new   divObject(document[divName]);  
  }  
                                                  e.divObj.style.top   =   menuBottom;  
  }   else   {  
                                                  document.writeln   (aLine);  
  }  
  if   (e.FirstChild   >   -1)   {  
  if   ((theBrowser.hasDHTML)   ||   (e.isopen   &&   isVisible))   {  
  tempStr   =   (e.nextItem   ==   -1)   ?   'iconBlank'   :   'iconLine';  
  this.drawALevel(e.FirstChild,   indentStr   +   imgStore.getTag(tempStr,   ''),   (e.isopen   &&   isVisible));  
  }  
  }  
  currEntry   =   e.nextItem;  
  }  
  }  
  function   refreshMenu(positionMenu)   {  
  if   (theBrowser.hasDHTML)   {  
  this.refreshDHTML(positionMenu);  
  }   else   {  
  this.reload(positionMenu);  
  }  
  }  
  function   reloadMenu(positionMenu)   {  
  if   (theBrowser.hasDHTML)   {  
                                  location.reload();  
  }   else   {  
                                  var   newLocation   =   location.pathname;  
                                  location.reload();  
  if   (positionMenu)   {  
  if   (theBrowser.mustMoveAfterLoad   ==   false)   {  
  newLocation   +=   "#plusMinus"   +   this.lastPMClicked;  
  this.lastPMClicked   =   0;  
  }  
  }   else   {  
  this.lastPMClicked   =   0;  
  }  
  if   (theBrowser.hasRentrantBug)   {  
                                                  setTimeout("replace('"   +   newLocation   +   "');",   200);  
  }   else   {  
                                                  replace(newLocation);  
  }  
  }  
  }  
  function   refreshMenuDHTML(positionMenu)   {  
  var   nextItemArray   =   new   simpleArray  
  var   level   =   1;  
  var   currEntry   =   0;  
  var   isVisible   =   true;  
  var   lastVisibleLevel   =   1;  
  var   yPos   =   this.menuTop;  
  var   e   =   null;  
  var   s   =   null;  
   
  while   (level   >   0)   {  
  e   =   this.entry[currEntry];  
                                  s   =   e.divObj.style;  
  if   (isVisible)   {  
  s.top   =   yPos;  
  s.visibility   =   'visible';  
                                                  yPos   +=   this.entryHeight;  
  lastVisibleLevel   =   level;  
  }   else   {  
  s.visibility   =   'hidden';  
  }  
  if   (e.FirstChild   >   -1)   {  
  isVisible   =   (e.isopen   ==   true)   &&   isVisible;  
  nextItemArray[level++]   =   e.nextItem;  
  currEntry   =   e.FirstChild;  
  }   else   {  
  if   (e.nextItem   !=   -1)   {  
  currEntry   =   e.nextItem;  
  }   else   {  
  while   (level   >   0)   {  
  if   (nextItemArray[--level]   !=   -1)   {  
  currEntry   =   nextItemArray[level];  
  isVisible   =   (lastVisibleLevel   >=   level);  
  break;  
  }  
  }  
  }  
  }  
  }  
  var   pmc   =   this.lastPMClicked  
  if   (pmc   >=   0)   {  
  e   =   this.entry[pmc];  
  var   srTop   =   e.divObj.style.top  
  var   srBot   =   (e.nextItem   >   0)   ?   this.entry[e.nextItem].divObj.style.top   :   yPos;  
                                  var   curTop   =   this.pageYOffset;  
                                  var   curBot   =   curTop   +   this.innerHeight;  
  if   ((srBot   >   curBot)   ||   (srTop   <   curTop))   {  
  var   scrBy   =   srBot   -   curBot;  
  if   (srTop   <   (curTop   +   scrBy))   {   scrBy   =   srTop   -   curTop;   }  
                                                  scrollBy(0,   scrBy);  
  }  
  }  
  }  
   
  function   itemClicked(entryNo)   {  
  var   e   =   this.entry[entryNo]  
   
  if   ((e.url   !=   '')   &&   (e.url   !=   'javascript:void(0);'))   {  
  if   (this.selectedEntry   >=   0)   {this.entry[this.selectedEntry].setSelected(false);}  
  this.selectedEntry   =   entryNo;  
  if   (entryNo   >=   0)   {e.setSelected(true);}  
  }  
  if   (this.wizardInstalled)   {  
  self.text.menuItemClicked(entryNo);  
  }  
  if   (this.toggleOnLink)   {this.toggle(entryNo);}  
  }  
  function   setEntry(entryNo,   state)   {  
  var   mc   =   false;  
  var   cl   =   ','   +   entryNo   +   ',';  
  var   e   =   this.entry[entryNo];  
  this.lastPMClicked   =   entryNo  
  mc   =   e.setIsOpen(state)   ||   mc;  
  var   p   =   e.parent;  
  while   (p   >=   0)   {  
  cl   +=   p   +   ',';  
  e   =   this.entry[p];  
  mc   =   (e.setIsOpen(true))   ||   mc;  
  p   =   e.parent;  
  }  
  if   (this.modalFolders)   {  
  for   (var   i   =   0;   i   <=   this.count;   i++)   {  
  if   (cl.indexOf(','   +   i   +   ',')   <   0)   {  
  mc   =   this.entry[i].setIsOpen(false)   ||   mc;  
  }  
  }  
  }  
  return   mc;  
  }  
  function   setEntryByURL(theURL,   state)   {  
  var   i   =   this.findEntry(theURL);  
  if   (i   !=   -1)   {  
  if   (this.entry[i].parent   !=   -1)   {return   this.setEntry(this.entry[i].parent,   state);}  
  }  
  }  
  function   setAll(state,nowmenu)   {  
  var   hasChanged   =   false;  
   
                  with   (nowmenu)   {  
  for   (var   i   =   0;   i   <=   count;   i++)   {  
          hasChanged   =   entry[i].setIsOpen(state)   ||   hasChanged;  
  }  
  if   (hasChanged)   {   refresh(false);   }  
  }  
  }  
  Top

7 楼yaofen(抵制日货)回复于 2005-01-28 10:47:14 得分 0

我晕,好多,我先看下!Top

8 楼rwj(无聊男孩)回复于 2005-01-28 10:49:52 得分 0

还有一段。  
   
  function   openAll()   {   setAll(true,this);   }  
  function   closeAll()   {   setAll(false,this);   }  
   
  function   findEntry(theURL)   {  
  var   res   =   -1  
  for   (var   i   =   0;   i   <=   this.count;   i++)   {  
  if   (this.entry[i].url   ==   theURL)   {  
  res   =   i;  
  break;  
  }  
  }  
  return   res;  
  }  
   
  function   toggle(entryNo)   {  
  var   e   =   this.entry[entryNo]  
  var   chg   =   this.setEntry(entryNo,   e.isopen   ^   1);  
  if   (this.linkOnExpand   &&   e.isopen   &&   (e.url   !=   ''))   {  
  if   (myOpener   !=   null)   {  
  myOpener.text.location   =   e.url;  
  }   else   {  
  self.text.location   =   e.url;  
  }  
  this.itemClicked(entryNo);  
  }  
  if   (chg)   {this.refresh(this.autoScrolling   &&   (this.lastPMClicked   >   0));}  
  }  
  //   Other   functions  
  function   browserInfo()   {  
  this.code   =   'unknown';  
  this.version   =   0;  
  this.platform   =   'Win';  
   
  var   i   =   navigator.userAgent.indexOf('MSIE');  
  if   (i   >=   0)   {  
  this.code   =   'MSIE';  
  this.version   =   parseFloat(navigator.userAgent.substring(i+5,   i+9));  
  }   else   {  
  i   =   navigator.userAgent.indexOf('Mozilla/')  
  if   (i   >=   0)   {  
  this.code   =   'NS';  
  this.version   =   parseFloat(navigator.userAgent.substring(i+8,   i+12));  
  }  
  }  
  if   (navigator.userAgent.indexOf('Mac')   >=   0)   {this.platform   =   'Mac';}  
  if   (navigator.userAgent.indexOf('OS/2')   >=   0)   {this.platform   =   'OS/2';}  
  if   (navigator.userAgent.indexOf('X11')   >=   0)   {this.platform   =   'UNIX';}  
   
  this.canCache   =   ((this.code   ==   'NS')   &&   (this.version   >=   3))   ||   ((this.code   ==   'MSIE')   &&   (this.version   >=   4))   ;  
  this.canOnMouseOut   =   ((this.code   ==   'NS')   &&   (this.version   >=   3));  
  this.hasRentrantBug   =   ((this.code   ==   'NS')   &&   (this.version   ==   2.01)   &&   (this.platform   !=   'Win'));  
  this.canJSVoid   =   !(((this.code   ==   'NS')   &&   (this.version   <   3))   ||   ((this.code   ==   'MSIE')   &&   (this.version   <   4)));  
  this.mustMoveAfterLoad   =   ((this.code   ==   'NS')   &&   (this.version   >=   3));  
  this.hasDHTML   =   ((this.code   ==   'NS')   &&   (this.version   >=   4))   ||   ((this.code   ==   'MSIE')   &&   (this.version   >=   4));  
  }  
  function   setStatus(theText)   {  
  var   theWindow   =   window;  
  if   (getMode()   ==   'Floating')   {theWindow   =   myOpener;}  
  theWindow.status   =   theText;  
  if   (theBrowser.canOnMouseOut   ==   false)   {  
  clearTimeout(statusTimeout);  
  statusTimeout   =   setTimeout('clearStatus()',   5000);}  
  return   true;  
  }  
  function   clearStatus()   {  
  var   theWindow   =   window;  
  if   (getMode()   ==   'Floating')   {theWindow   =   myOpener;}  
  if   (theWindow   !=   null)   {theWindow.status   =   '';}  
  }  
  function   unloadFloating()   {  
  if   (myOpener   !=   null)   {  
  if   (theBrowser.code   ==   'MSIE')   {  
  myOpener.setTimeout('menuClosed();',   10);  
  }   else   {  
  myOpener.menuClosed();  
  }  
  }  
  }  
  function   getMode()   {  
  var   cookieText   =   document.cookie;  
  var   theResult   =   "Frames";  
  if   (cookieText.length   >   0)   {  
  if   (cookieText.indexOf("mode=Floating")   >=   0)   {  
  theResult   =   "Floating";  
  }   else   {  
  if   (cookieText.indexOf("mode=NoFrames")   >=   0)   {  
  theResult   =   "NoFrames";  
  }  
  }  
  }  
  return   theResult;  
  }  
  function   initOutlineIcons()   {  
  var   ip   =   '../images/TreeImages/';  
  imgStore.add('iconPlusTop',   ip   +   'plustop.GIF',   18,   16);  
  imgStore.add('iconPlus',   ip   +   'plus.GIF',   18,   16);  
  imgStore.add('iconPlusBottom',   ip   +   'plusbottom.GIF',   18,   16);  
  imgStore.add('iconPlusOnly',   ip   +   'plusonly.GIF',   18,   16);  
  imgStore.add('iconMinusTop',   ip   +   'minustop.GIF',   18,   16);  
  imgStore.add('iconMinus',   ip   +   'minus.GIF',   18,   16);  
  imgStore.add('iconMinusBottom',   ip   +   'minusbottom.GIF',   18,   16);  
  imgStore.add('iconMinusOnly',   ip   +   'minusonly.GIF',   18,   16);  
  imgStore.add('iconLine',   ip   +   'line.GIF',   18,   16);  
  imgStore.add('iconBlank',   ip   +   'blank.GIF',   18,   16);  
  imgStore.add('iconJoinTop',   ip   +   'jointop.GIF',   18,   16);  
  imgStore.add('iconJoin',   ip   +   'join.GIF',   18,   16);  
  imgStore.add('iconJoinBottom',   ip   +   'joinbottom.GIF',   18,   16);  
   
  //Add   folder   and   document   images   to   the   imgStore.  
  imgStore.add('Folder',   ip   +   'folderclosed.GIF',   18,   16);  
  var   di   =   ip   +   ((theBrowser.code   ==   'NS')   ?   'document2.GIF'   :   'document.GIF');  
  imgStore.add('Document',   di,   18,   16);  
  }  
  //             ############################       End   of   Joust       ############################  
  Top

9 楼rwj(无聊男孩)回复于 2005-01-28 10:50:26 得分 0

哈。。。终于贴完了。你留下EMAIL。我把代码发给你吧。Top

10 楼ding_dong(康康)回复于 2005-01-28 10:51:32 得分 30

看我做的我做的网站:www.worldworks.cn,如果符合你要求,加我:qq:444068Top

11 楼yaofen(抵制日货)回复于 2005-01-28 11:00:57 得分 0

我的邮箱lbsdwb@163.com,多谢,我先试试!Top

12 楼myvicy(我来也!)回复于 2005-01-28 11:11:06 得分 0

帮Top

13 楼llhly(无名)回复于 2005-01-28 11:20:28 得分 0

动态的树形菜单,我找了很久了//  
  llhly@126.com  
  给我发一个,谢谢!Top

14 楼rwj(无聊男孩)回复于 2005-01-28 11:46:28 得分 20

llhly(无名)我已经发了。你查看一下。Top

15 楼yaofen(抵制日货)回复于 2005-01-28 13:35:18 得分 0

根据   ding_dong(康康)给的代码改动如下,实现点击列出小类,再点小类隐藏的功能,发出源码,以备后用!  
  <SCRIPT   language=javascript1.2>  
  function   JyDownShowList(id)  
  {  
  whichEl   =   eval("tabletitle"+id);  
  if   (whichEl.style.display   ==   "none")  
  {eval("tabletitle"+id+".style.display=\"\";");}  
  else  
  {eval("tabletitle"+id+".style.display=\"none\";");}  
  }  
  </SCRIPT>  
                                                      <%    
  dim   rs1,sql1,j  
  j=0  
  set   rs1=server.CreateObject("adodb.recordset")  
  sql1="select   category,categoryid   from   bclass   order   by   categoryid   asc"  
  rs1.open   sql1,cn,1,1  
  if   not   rs1.eof   then  
  do   while   not   rs1.eof  
  %>  
                                                      <tr>  
                                                          <td   width="135"   onClick="JyDownShowList(<%=   rs1("categoryid")   %>)"   style="cursor:hand   ">  
                                                              <div   align="center"><font   color="#FF0000"><%=rs1("category")%>  
      </font></div>  
                                                          </td>  
                                                      </tr>    
   
  <tr   style="display:none"   id='tabletitle<%=   rs1("categoryid")   %>'><td>  
  <%  
       
          dim   rs2,sql2  
      set   rs2=server.CreateObject("adodb.recordset")  
      sql2="select   *   from   sclass   where   categoryid="&rs1("categoryid")&"   order   by   categoryid   asc"  
      rs2.open   sql2,cn,1,1  
      if   not   rs2.eof   then  
      do   while   not   rs2.eof  
      %>  
                    <table   width="100%"     border="0">  
                          <tr>  
                          <td>   <a   href="cp.asp?sortsid=<%=rs2("sortsid")%>&categoryid=<%=rs2("categoryid")%>","_self"><div   align="center">&nbsp;<%=rs2("sorts")%></div></a></td>  
                            </tr>  
                            </table>  
                      <%  
      rs2.movenext  
      loop  
      end   if  
      rs2.close  
      set   rs2=nothing  
      %></td></tr>  
                  <%  
  rs1.movenext  
  loop  
  end   if  
   
  rs1.close  
  set   rs1=nothing  
  %>Top

相关问题

  • 分层动态显示的问题
  • 怎样做类似delphi中reopen那种可以动态显示的子菜单?一定给分!
  • CDateTimeCtrl类控件能否动态显示时间?????????
  • 着急找动态显示曲线的类
  • 散分!!Delphi中自做动态显示的控件!!!散分!!
  • 能否动态选择ADODataSet(或类似之类的控件)的字段,并动态地显示在DBGrid中?
  • 类似netants的信息显示窗口,显示时从左到右动态显示是如何实现的?
  • 100求教php动态二级分类。。。。。
  • 如何在窗口底部动态显示信息??(15分)
  • 如何实现动态改变窗体部分显示

关键词

  • os/2
  • 小类

得分解答快速导航

  • 帖主:yaofen
  • ding_dong
  • rwj

相关链接

  • Web开发类图书

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo