t;
2. 只打开一个节点,关闭其他兄弟节点(Just one expanded node, all other will collaps)
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>LeftMenu_Tree</title>
</head>
<body bgcolor="#DDEDFD">
<form id="form1" runat="server">
<a href="javascript:TreeviewExpandCollapseAll('<%=TreeView1.ClientID%>', true)">Expand
All</a> , <a href="javascript:TreeviewExpandCollapseAll('<%=TreeView1.ClientID%>', false)">
Collapse All</a>
<asp:TreeView ID="TreeView1" SkinID="tvClass" runat="server" ShowLines="true" NodeWrap="false">
</asp:TreeView>
</form>
</body>
</html>
<script language="javascript">
//2. 只打开一个节点,关闭其他兄弟节点(Just one expanded node, all other will collaps)
function TreeView_ToggleNode(data, index, node, lineType, children)
{
var img = node.childNodes[0];
var newExpandState;
try {
//***折叠兄弟节点(Collapse Brothers)-----
CollapseBrothers(data,children);
//---------------------------------------
if (children.style.display == "none")
{
children.style.display = "block";
newExpandState = "e";
if ((typeof(img) != "undefined") && (img != null))
{
if (lineType == "l")
{
img.src = data.images[15];
}
else if (lineType == "t")
{
img.src = data.images;
}
else if (lineType == "-")
{
img.src = data.images[18];
}
else
{
img.src = data.images;
}
img.alt = data.collapseToolTip.replace(/\{0\}/, TreeView_GetNodeText(node));
}
}
else
{
children.style.display = "none";
newExpandState = "c";
if ((typeof(img) != "undefined") && (img != null))
{
if (lineType == "l")
{
img.src = data.images;
}
else if (lineType == "t")
{
img.src = data.images;
}
else if (lineType == "-")
{
img.src = data.images[17];
}
else
{
img.src = data.images;
}
img.alt = data.expandToolTip.replace(/\{0\}/, TreeView_GetNodeText(node));
}
}
}
catch(e) {}
data.expandState.value = data.expandState.value.substring(0, index) + newExpandState + data.expandState.value.slice(index + 1);
}
//折叠兄弟节点(Collapse Brothers)
function CollapseBrothers(data,childContainer)
{
var parent