樹形控制元件(MS TreeView 6.0 ActiveX Control)在網頁中的應用
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
TreeView 6.0
<br>
<object classid="clsid:C74190B6-8589-11D1-B16A-00C0F0283628" id="TreeView1" width="259" height="386">
<param name="_ExtentX" value="6853">
<param name="_ExtentY" value="10213">
<param name="_Version" value="393217">
<param name="HideSelection" value="1">
<param name="Indentation" value="1000">
<param name="LabelEdit" value="0">
<param name="LineStyle" value="0">
<param name="PathSeparator" value="/">
<param name="Sorted" value="0">
<param name="Style" value="7">
<param name="Checkboxes" value="0">
<param name="FullRowSelect" value="0">
<param name="HotTracking" value="0">
<param name="Scroll" value="1">
<param name="SingleSel" value="0">
<param name="ImageList" value>
<param name="BorderStyle" value="0">
<param name="Appearance" value="1">
<param name="MousePointer" value="0">
<param name="Enabled" value="1">
<param name="OLEDragMode" value="0">
<param name="OLEDropMode" value="0">
</object>
</td>
<td valign=top>
<FIELDSET>
<LEGEND>SelectedItem</LEGEND>
<br>Text <input type="text" id="Text1" size="20" maxlength="50">
<br>Key <input type="text" id="Text2" size="20" maxlength="50">
<br>Index<input type="text" id="Text3" size="20" maxlength="50">
<br>Expanded<input type="text" id="Text4" size="20" maxlength="50">
<br>FullPath<input type="text" id="Text5" size="20" maxlength="50">
<br>Checked<input type="text" id="Text6" size="20" maxlength="50">
<br>Selected<input type="text" id="Text7" size="20" maxlength="50">
</FIELDSET>
</td>
</tr>
</table>
<SCRIPT language=javascript>
TreeView1.Font.Size = 10
TreeView1.Font.Name = "宋體"
TreeView1.CheckBoxes = "-1"
TreeView1.LineStyle = "1" //0=tvwTreeLines / 1=tvwRootLines
TreeView1.Indentation = "20"
TreeView1.PathSeparator = "//"
TreeView1.LabelEdit = "1" //0=tvwAutomatic / 1=tvwManul
//object.Add (relative, relationship, key, text, image, selectedimage TreeView1.Nodes.Add(null,1,"NXG1%","濰坊市")
TreeView1.Nodes.Add("NXG1%",4,"NXG1001","臨朐縣")
TreeView1.Nodes.Add("NXG1001",4,"NXG1001a","某某鄉鎮")
TreeView1.Nodes.Add("NXG1001",4,"NXG1001b","某某鄉鎮")
TreeView1.Nodes.Add("NXG1001",4,"NXG1001c","某某鄉鎮")
TreeView1.Nodes.Add("NXG1%",4,"NXG1002","青州市")
TreeView1.Nodes.Add("NXG1%",4,"NXG1003","高密市")
TreeView1.Nodes.Add("NXG1%",4,"NXG1004","壽光市")
TreeView1.Nodes.Add("NXG1%",4,"NXG1005","諸城市")
TreeView1.Nodes.Add(null,2,"NXG2%","濰坊市")
TreeView1.Nodes.Add("NXG2%",4,"NXG2001","臨朐縣")
TreeView1.Nodes.Add("NXG2%",4,"NXG2002","青州市")
TreeView1.Nodes.Add("NXG2%",4,"NXG2003","高密市")
TreeView1.Nodes.Add("NXG2%",4,"NXG2004","壽光市")
TreeView1.Nodes.Add("NXG2%",4,"NXG2005","諸城市")
TreeView1.Nodes.Add(null,4,"NXG4%","濰坊市")
TreeView1.Nodes.Add("NXG4%",4,"NXG4001","臨朐縣")
TreeView1.Nodes.Add("NXG4%",4,"NXG4002","青州市")
TreeView1.Nodes.Add("NXG4%",4,"NXG4003","高密市")
TreeView1.Nodes.Add("NXG4%",4,"NXG4004","壽光市")
TreeView1.Nodes.Add("NXG4%",4,"NXG4005","諸城市")
for(i=6;i<2001;i++){
TreeView1.Nodes.Add("NXG4%",4,"NXG"+(4000+i),"諸城市")
}
//alert(TreeView1.Nodes.Item[1])//.checkbox = true
//alert(TreeView1.Nodes("NXG4%").Children)
//alert(TreeView1.SelectedItem)
//alert(TreeView1.Nodes.Item[0].Text)
TreeView1.Nodes.Item("NXG1%").Expanded = true
TreeView1.Nodes.Item("NXG2%").Expanded = true
//TreeView1.Nodes.Item("NXG4%").Expanded = true
</SCRIPT>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function TreeView1_Click() {
var o = (TreeView1.SelectedItem);
//alert(TreeView1.CheckBoxes)
Text1.value = o.Text
Text2.value = o.Key
Text3.value = o.Index
Text4.value = o.Expanded
Text5.value = o.FullPath
Text6.value = o.Checked
Text7.value = o.Selected
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE=javascript FOR=TreeView1 EVENT=Click>
<!--
TreeView1_Click()
//-->
</SCRIPT>