javascript 访问treeview的节点

类别:软件工程 点击:0 评论:0 推荐:

想在客户端根据treenode写一个事件,缺不知怎么得到treenode。找了半天,终于在msdn找到
function aa() { var myVal = document.all.TreeView1.selectedNodeIndex; //var myVal = window.event.treeNodeIndex; var myNode = TreeView1.getTreeNode(myVal); alert(myVal); alert(myNode.getAttribute("id")); //var SID = document.all.TreeView1.GetNodeFromIndex(nodeIndex).ID //alert(nodeIndex); //window.open ("WebForm2.aspx?ID=" + SID); } function aa() { var myVal = document.all.TreeView1.selectedNodeIndex; //var myVal = window.event.treeNodeIndex; var myNode = TreeView1.getTreeNode(myVal); alert(myVal); alert(myNode.getAttribute("id")); //var SID = document.all.TreeView1.GetNodeFromIndex(nodeIndex).ID //alert(nodeIndex); //window.open ("WebForm2.aspx?ID=" + SID); }  <script >
var nodeindex = document.all.treeview1.selectedNodeIndex;
var myNode = treeview1.getTreeNode(nodeindex);
myNode.getAttribute(“text“);
</script>

reference  http://msdn.microsoft.com/library/default.asp?url=/workshop/webcontrols/overview/treeview.asp

本文地址:http://com.8s8s.com/it/it35481.htm