答案:本程序有两文件test.asp 和tree.asp 还有一些图标文件<br>
1。test.asp 调用类生成树 代码如下<br>
<%@ Language=VBScript %><br>
<html><br>
<head><br>
<link rel="stylesheet" href=><title>tree</title><br>
</head><br>
<!-- #include file="tree.asp" --><br>
<%<br>
<br>
'========================================<br>
' BUILDING A TREE PROGRAMATICALLY<br>
'========================================<br>
' This approach would be best suited for building<br>
' dynamic trees using For..Next loops and such.<br>
<br>
Set MyTree2 = New Tree<br>
MyTree2.Top = 10<br>
MyTree2.Left = 10<br>
MyTree2.ExpandImage = "plus.gif"<br>
MyTree2.CollapseImage = "minus.gif"<br>
MyTree2.LeafImage = "webpage.gif"<br>
<br>
' Notice the indentation used to reprensent the hierarchy<br>
Set Node1 = MyTree2.CreateChild("script")<br>
Set SubNode1 = Node1.CreateChild("server")<br>
Set secSubNode1 = SubNode1.CreateChild("html")<br>
secSubNode1.CreateChild "<A HREF=> secSubNode1.CreateChild "<A HREF=> secSubNode1.CreateChild "<A HREF=> <br>
Set SubNode2 = Node1.CreateChild("os")<br>
SubNode2.CreateChild "<A HREF=> SubNode2.CreateChild "<A HREF=> <br>
Set Node2 = MyTree2.CreateChild("Desktop")<br>
Node2.CreateChild "<A HREF=> Node2.CreateChild "<A HREF=> Node2.CreateChild "<A HREF=> <br>
MyTree2.Draw()<br>
<br>
Set MyTree2 = Nothing<br>
<br>
%><br>
<br>
</BODY><br>
</HTML><br>
2。tree.asp 类的定义 代码如下<br>
<%<br>
'******************************************************<br>
' Author: Jacob Gilley<br>
' Email: avis7@airmail.net<br>
' My Terms: You can use this control in anyway you see fit<br>
' cause I have no means to enforce any guidelines<br>
' or BS that most developers think they can get<br>
' you to agree to by spouting out words like <br>
' "intellectual property" and "The Code Gods".<br>
' - Viva la Microsoft!<br>
'******************************************************<br>
<br>
Dim gblTreeNodeCount:gblTreeNodeCount = 1<br>
<br>
Class TreeNode<br>
<br>
Public Value<br>
Public ExpandImage<br>
Public CollapseImage<br>
Public LeafImage<br>
Public Expanded<br>
Private mszName<br>
Private mcolChildren<br>
Private mbChildrenInitialized<br>
<br>
Public Property Get ChildCount()<br>
ChildCount = mcolChildren.Count<br>
End Property<br>
<br>
Private Sub Class_Initialize()<br>
mszName = "node" & CStr(gblTreeNodeCount)<br>
gblTreeNodeCount = gblTreeNodeCount + 1<br>
<br>
&
上一个:这个问题我刚刚前两天做过,呵呵(会不会加入精华区)
下一个:利用ADODB.Stream使用浏览器下载服务器文件