这个是一个树形控件的例子,就象注册表的结构一样,但是我想知道当点击某个结点时,弹出框 msgbox显示我所点击的结点的字符串,谢谢高手回答我!下面是代码:
<HTML>
<script language=vbscript>
option explicit
public x
Sub window_onload
dim i
TreeView1.Nodes.Add ,,"d1","A1"
TreeView1.Nodes.Add ,,"d2","A2"
TreeView1.Nodes.Add "d1", 4, "d3", "A1-1"
TreeView1.Nodes.Add "d1", 4, "d4", "A1-2"
TreeView1.Nodes.Add "d1", 4, "d5", "A1-3"
TreeView1.Nodes.Add "d1", 4, "d6", "A1-3"
TreeView1.Nodes.Add "d2", 4, "d7", "A2-1"
TreeView1.Nodes.Add "d2", 4, "d8", "A2-1"
TreeView1.Nodes.Add "d2", 4, "d9", "A2-2"
TreeView1.Nodes.Add "d4", 4, "d10", "A1-2-1"
TreeView1.Nodes.Add "d4", 4, "d11", "A1-2-2"
TreeView1.Nodes.Add "d4", 4, "d12", "A1-2-3"
TreeView1.Nodes.Add "d5", 4, "d13", "A1-3-1"
TreeView1.Nodes.Add "d5", 4, "d14", "A1-3-2"
for i = 1 to TreeView1.Nodes.Count
TreeView1.Nodes(i).Expanded = true
next
End Sub
</script>
<object classid="clsid:C74190B6-8589-11D1-B16A-00C0F0283628" height="600" width="450" id="TreeView1" name="TreeView1" style="LEFT:0px; TOP: 0px" Viewastext >
<param name="_ExtentX" value="5265">
<param name="_ExtentY" value="7673">
<param name="_Version" value="327682">
<param name="Appearance" value="0">
<param name="BorderStyle" value="1">
<param name="Enabled" value="1">
<param name="HideSelection" value="0">
<param name="Indentation" value="529">
<param name="LabelEdit" value="1">
<param name="LineStyle" value="1">
<param name="MousePointer" value="0">
<param name="OLEDragMode" value="0">
<param name="PathSeparator" value="">
<param name="Sorted" value="1">
<param name="Style" value="7">
</object>
</BODY>
</HTML>
參考答案:你可以用时间控件来适时检测结点的内容,发生变化说明你单击了其它结点,所以触发事件。