本程序有两文件test.asp 和tree.asp 还有一些图标文件<br>
1。test.asp 调用类生成树 代码如下<br>
<%@ Language=VBScript %><br>
<html><br>
<head><br>
<link rel="stylesheet" href="tree.css"><br>
<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=""http://127.0.0.1/"">asp</A>"<br>
secSubNode1.CreateChild "<A HREF=""http://127.0.0.1/"">php</A>"<br>
secSubNode1.CreateChild "<A HREF=""http://127.0.0.1/"">jsp</A>"<br>
<br>
Set SubNode2 = Node1.CreateChild("os")<br>
SubNode2.CreateChild "<A HREF=""#"">winnt</A>"<br>
SubNode2.CreateChild "<A HREF=""#"">win2000</A>"<br>
<br>
Set Node2 = MyTree2.CreateChild("Desktop")<br>
Node2.CreateChild "<A HREF=""#"">Area Code Lookup</A>"<br>
Node2.CreateChild "<A HREF=""#"">Arin Based Whois Search</A>"<br>
Node2.CreateChild "<A HREF=""#"">World Time Zone Map</A>"<br>
<br>
MyTree2.Draw()<br>