日期:2014-05-16  浏览次数:20407 次

JS实现动态树结构
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	<title>destroydrop &raquo; JavaScripts &raquo Tree</title>
	<meta http-equiv="Content-Type" content="text/html; charset=GBK">
	<link rel="StyleSheet" href="tree.css" type="text/css">
	<script type="text/javascript" src="tree.js"></script>
	<script type="text/javascript">
		<!--
		var Tree = new Array;
		// nodeId | parentNodeId | nodeName | nodeUrl
		Tree[0]  = "1|0|1|#";
		Tree[1]	 = "2|1|2|#";
		Tree[2]  = "3|1|3|#";
		Tree[3]  = "4|3|4|#";
		Tree[4]  = "5|1|5|#";
		Tree[5]  = "6|2|6|#";
		Tree[6]  = "7|6|7|#";
		Tree[7]  = "8|6|8|#";
		Tree[8]  = "9|1|9|#";
		Tree[9]  = "10|9|10|#";
		Tree[10] = "11|0|11|#";
		//-->
	</script>
</head>

<body>




<div class="tree">
<script type="text/javascript">
<!--
	createTree(Tree,1);  // start the tree at node nr. 1
//-->
</script>
</div>

<br /><br />

</body>
</html>


上面应用的两个文件在下面的压缩包中.
1 楼 zhanqitan 2011-11-08  
谢了有帮助