<asp:treeview id="treeview1" runat="server" datasourceid="xmldatasource1" showcheckboxes="all">
<databindings>
<script language="javascript" type="text/javascript">
function client_ontreenodechecked()
{
var obj = window.event.srcelement;
var treenodefound = false;
var checkedstate;
if (obj.tagname == "input" && obj.type == "checkbox") {
var treenode = obj;
checkedstate = treenode.checked;
do
{
obj = obj.parentelement;
} while (obj.tagname != "table")
var parenttreelevel = obj.rows[0].cells.length;
var parenttreenode = obj.rows[0].cells[0];
var tables = obj.parentelement.getelementsbytagname("table");
var numtables = tables.length
if (numtables >= 1)
{
for (i=0; i < numtables; i++)
{
if (tables[i] == obj)
{
treenodefound = true;
i++;
if (i == numtables)
{
return;
}
}
if (treenodefound == true)
{
var childtreelevel = tables[i].rows[0].cells.length;
if (childtreelevel > parenttreelevel)
{
var cell = tables[i].rows[0].cells[childtreelevel - 1];
var inputs = cell.getelementsbytagname("input");
inputs[0].checked = checkedstate;
}
else
{
return;
}
}
}
}
}
}
</script>
新闻热点
疑难解答
图片精选