首页 > 代码库 > 静态树的形成
静态树的形成
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>jtshu</title>
</head>
<!--导入js和css-->
<link href="http://www.mamicode.com/css/jquery.treeview.css" type="text/css" rel="stylesheet" />
<script src="http://www.mamicode.com/js/jquery.js" type="text/javascript"></script>
<script src="http://www.mamicode.com/js/jquery.treeview.js" type="text/javascript"></script>
<script src="http://www.mamicode.com/js/jquery.cookie.js" type="text/javascript"></script>
<script>
//获取id为tree的zTree对象
var treeObj = $.fn.zTree.getZTreeObj("tree")
var treeObj = $.fn.zTree.getZTreeObj("tree")
</script>
<body>
<script type="text/javascript">
$(document).ready(function() {
$("#tree").treeview({
persist: "location",
collapsed: true,
unique: true
});
});
</script>
<ul id="tree" class="filetree">
<li><span class="folder">节点1</span>
<ul>
<li><span class="folder">节点1.1</span>
<ul>
<li><span class="folder">节点1.1.1</span></li>
<li><span class="folder">节点1.1.2</span></li>
</ul>
</li>
</ul>
</li>
<li><span class="folder">节点2</span>
<ul>
<li><span class="folder">节点2.1</span>
<ul>
<li><span class="folder">节点2.1.1</span></li>
<li><span class="folder">节点2.1.2</span></li>
</ul>
</li>
<li><span class="folder">节点2.2</span>
<ul>
<li><span class="folder">节点2.2.1</span></li>
<li><span class="folder">节点2.2.2</span></li>
</ul>
</li>
</ul>
</li>
<li><span class="folder">节点3</span>
<ul>
<li><span class="folder">节点3.1</span></li>
<li><span class="folder">节点3.2</span></li>
<li><span class="folder">节点3.3</span></li>
</ul>
</li>
<li><span class="folder">节点4</span>
<ul>
<li><span class="folder">节点4.1</span></li>
<li><span class="folder">节点4.2</span></li>
<li><span class="folder">节点4.3</span></li>
<li><span class="folder">节点4.4</span></li>
</ul>
</li>
</ul>
</ul>
</body>
</html>
js和css文件单独上传了哦,记得下载,在调用的时候记得填写正确的路径
静态树的形成