- Rongsen.Com.Cn 版权所有 2008-2010 京ICP备08007000号 京公海网安备11010802026356号 朝阳网安编号:110105199号
- 北京黑客防线网安工作室-黑客防线网安服务器维护基地为您提供专业的
服务器维护
,企业网站维护
,网站维护
服务 - (建议采用1024×768分辨率,以达到最佳视觉效果) Powered by 黑客防线网安 ©2009-2010 www.rongsen.com.cn
作者:黑客防线网安ASP维护基地 来源:黑客防线网安ASP维护基地 浏览次数:0 |
2. 只打开一个节点(关闭其他兄弟节点)
<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. 只打开一个节点(关闭其他兄弟节点)------------------------------------------
function TreeView_ToggleNode(data, index, node, lineType, children)
{
var img = node.childNodes[0];
var newExpandState;
try {
//***折叠兄弟节点------------------------
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[12];
}
else if (lineType == "-")
{
img.src = data.images[18];
}
else
{
img.src = data.images[5];
}
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[14];
}
else if (lineType == "t")
{
img.src = data.images[11];
}
else if (lineType == "-")
{
img.src = data.images[17];
}
else
{
img.src = data.images[4];
}
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);
}
//折叠兄弟节点
function CollapseBrothers(data,childContainer)
{
var parent = childContainer.parentNode;
for(i=0; i< parent.childNodes.length; i++)
{
if(parent.childNodes[i].tagName.toLowerCase() =="div")
{
if(parent.childNodes[i].id != childContainer.id)
{
parent.childNodes[i].style.display = "none"
}
}
else if(parent.childNodes[i].tagName.toLowerCase() =="table")
{
var treeLinks = parent.childNodes[i].getElementsByTagName("a");
if(treeLinks.length > 2)
{
var j=0;
if(treeLinks[j].firstChild.tagName)
{
if(treeLinks[j].firstChild.tagName.toLowerCase() == "img")
{
var img = treeLinks[j].firstChild;
if(i==0)
img.src = data.images[8];
else if(i==parent.childNodes.length-2)
img.src = data.images[14];
else
img.src = data.images[11];
}
}
}
}
}
}
//-----------------------------------------------------------------------------
</script>
我要申请本站:N点 | 黑客防线官网 | |
专业服务器维护及网站维护手工安全搭建环境,网站安全加固服务。黑客防线网安服务器维护基地招商进行中!QQ:29769479 |