日期:2014-05-19  浏览次数:20421 次

TreeView节点选择问题
我想写一段JavaScript  

就是VS2005的TreeView中父节点的CheckBox被点击   则其下的所有子节点也被选中

子节点只要有一个选择   父节点也被选择上

子节点没有一个被选择   父节点就取消选择

生成的Html如下例子:

<table   cellpadding= "0 "   cellspacing= "0 "   style= "border-width:0; ">
<tr>
<td> <a   id= "TreeView1n28 "   href= "javascript:TreeView_ToggleNode(TreeView1_Data,28,TreeView1n28, 't ',TreeView1n28Nodes) "> <img   src= "/newage05/WebResource.axd?d=kP39DaBkcX3nDc8TPTZmFA9ltkOC-cU-wJ81PkoaXKc1&amp;t=633068737011406250 "   alt= "展开   华东区 "   style= "border-width:0; "   /> </a> </td> <td   style= "white-space:nowrap; "> <input   type= "checkbox "   name= "TreeView1n28CheckBox "   id= "TreeView1n28CheckBox "   checked= "checked "   title= "华东区 "   /> <span   class= "TreeView1_0 "   id= "TreeView1t28 "> 华东区 </span> </td>
</tr>
</table> <div   id= "TreeView1n28Nodes "   style= "display:none; ">
<table   cellpadding= "0 "   cellspacing= "0 "   style= "border-width:0; ">
<tr>
<td> <div   style= "width:20px;height:1px "> <img   src= "/newage05/WebResource.axd?d=kP39DaBkcX3nDc8TPTZmFOzOfgqIxtJDD6seXXB6xXU1&amp;t=633068737011406250 "   alt= " "   /> </div> </td> <td> <img   src= "/newage05/WebResource.axd?d=kP39DaBkcX3nDc8TPTZmFMm61_VsPsrfJiowqo-RHiM1&amp;t=633068737011406250 "   alt= " "   /> </td> <td   style= "white-space:nowrap; "> <input   type= "checkbox "   name= "TreeView1n29CheckBox "   id= "TreeView1n29CheckBox "   checked= "checked "   title= "徐州成功店 "   /> <span   class= "TreeView1_0 "   id= "TreeView1t29 "> 徐州成功店 </span> </td>
</tr>
</table> <table   cellpadding= "0 "   cellspacing= "0 "   style= "border-width:0; ">
<tr>
<td> <div   style= "width:20px;height:1px "> <img   src= "/newage05/WebResource.axd?d=kP39DaBkcX3nDc8TPTZmFOzOfgqIxtJDD6seXXB6xXU1&amp;t=633068737011406250 "   alt= " "   /> </div> </td> <td> <img   src= "/newage05/WebResource.axd?d=kP39DaBkcX3nDc8TPTZmFMm61_VsPsrfJiowqo-RHiM1&amp;t=633068737011406250 "   alt= " "   /> </td> <td   style= "white-space:nowrap; "> <input   type= "checkbox "   name= "TreeView1n30CheckBox "   id= "TreeView1n30CheckBox "   checked= "checked "   title= "南通七彩店 "   /> <span   class= "TreeView1_0 "   id= "TreeView1t30 "> 南通七彩店 </span> </td>
</tr>
</table> <table   cellpadding= "0 "   cellspacing= "0 "   style= "border-width:0; ">
<tr>
<td> <div   style= "width:20px;height:1px "> <img   src= "/newage05/WebResource.axd?d=kP39DaBkcX3nDc8TPTZmFOzOfgqIxtJDD6seXXB6xXU1&amp;t=633068737011406250 "   alt= " "   /> </div>