选择显示字体大小

关于生成目录树结构的类(2)

     class tree
  
  public top
  public left
  public expandimage
  public collapseimage
  public leafimage
  private mszposition
  private mcolchildren
  
  public property let absolute(bdata)
  if bdata then mszposition = "absolute" else mszposition = "relative"
  end property
  
  public property get absolute()
  absolute = cbool(mszposition = "absolute")
  end property
  
  private sub class_initialize()
  set mcolchildren = server.createobject("scripting.dictionary")
  mntop = 0
  mnleft = 0
  mszposition = "absolute"
  end sub
  
  private sub class_terminate()
  mcolchildren.removeall()
  set mcolchildren = nothing
  end sub
  
  public function createchild(szvalue)
  
  set createchild = new treenode
  
  createchild.value = szvalue
  createchild.expandimage = expandimage
  createchild.collapseimage = collapseimage
  createchild.leafimage = leafimage
  
  mcolchildren.add mcolchildren.count + 1, createchild
  
  end function
  
  public sub loadtemplate(szfilename)
  dim objworkingnode
  dim colnodestack
  dim fsobj, tsobj
  dim szline
  dim ncurrdepth, nnextdepth
  
  set colnodestack = server.createobject("scripting.dictionary")
  set fsobj = createobject("scripting.filesystemobject")
  set tsobj = fsobj.opentextfile(szfilename, 1)
  
  ncurrdepth = 0
  while not tsobj.atendofline
  nnextdepth = 1
  szline = tsobj.readline()
  
  if ncurrdepth = 0 then
  set objworkingnode = createchild(trim(szline))
  ncurrdepth = 1
  else
  while mid(szline,nnextdepth,1) = vbtab or mid(szline,nnextdepth,1) = " "
  nnextdepth = nnextdepth + 1
  wend
  
  if nnextdepth > 1 then szline = trim(mid(szline,nnextdepth))
  
  if szline <> "" then
  if nnextdepth > ncurrdepth then
  if colnodestack.exists(ncurrdepth) then
  set colnodestack.item(ncurrdepth) = objworkingnode
  else
  colnodestack.add ncurrdepth, objworkingnode
  end if
  
  set objworkingnode = objworkingnode.createchild(szline)
  
  ncurrdepth = ncurrdepth + 1
  elseif nnextdepth <= ncurrdepth then
  
  if nnextdepth > 1 then
  
  nnextdepth = nnextdepth - 1
  while not colnodestack.exists(nnextdepth) and nnextdepth > 1
  nnextdepth = nnextdepth - 1
  wend
  
  set objworkingnode = colnodestack.item(nnextdepth)
  set objworkingnode = objworkingnode.createchild(szline)
  
  nnextdepth = nnextdepth + 1
  else
  set objworkingnode = createchild(szline)
  end if
  
  ncurrdepth = nnextdepth
  end if
  end if
  
  end if
  wend
  
  tsobj.close()
  set tsobj = nothing
  set fsobj = nothing
  
  colnodestack.removeall()
  set colnodestack = nothing
  
  end sub
  
  
  public sub draw()
  
  addclientscript()
  
  response.write "<div id=""treectrl"" style=""left: " & left & "px; top: " & top & "px; position: " & mszposition & ";"">" & vbcrlf
  response.write "<form name=""treectrlfrm"" action=""" & request.servervariables("script_name") & """ method=""get"">" & vbcrlf
  response.write "<table border=""0"">" & vbcrlf
  response.write "<tr><td>" & vbcrlf
  
  for each childnode in mcolchildren.items
  childnode.draw()
  next
  
  response.write "</td></tr>" & vbcrlf
  response.write "</table>" & vbcrlf
  
  response.write "<input type=""hidden"" name=""togglenode"" value="""">" & vbcrlf
  response.write "</form>" & vbcrlf
  response.write "</div>" & vbcrlf
  
  end sub
  
  private sub addclientscript()
  %>
  <script language="javascript">
  
  function expandnode(sznodename)
  {
  if(document.layers != null) {
  document.treectrl.document.treectrlfrm.togglenode.value = sznodename;
  document.treectrl.document.treectrlfrm.submit();
  }
  else {
  document.all["treectrlfrm"].togglenode.value = sznodename;
  document.all["treectrlfrm"].submit();
  }
  }
  
  function collapsenode(sznodename)
  {
  if(document.layers != null) {
  document.treectrl.document.treectrlfrm.elements[sznodename].value = -1;
  document.treectrl.document.treectrlfrm.submit();
  }
  else {
  document.treectrlfrm.elements[sznodename].value = -1;
  document.treectrlfrm.submit();
  }
  }
  
  </script>
  <%
  end sub
  
  end class
  
  %>
  演示地址:http://www.cnaspol.com/templatetree/test.asp
  
  
  
    


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons