가장 간단한 zTree 응용 사례
3237 단어 ztree
<!DOCTYPE html>
<html lang="zh-cn">
<head>
<title>index.html</title>
<meta charset="utf-8">
<link rel="stylesheet" href="zTree_v3/css/zTreeStyle/zTreeStyle.css">
<script type="text/javascript" src="zTree_v3/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="zTree_v3/js/jquery.ztree.core-3.5.js"></script>
<style>
body {
background-color: white;
margin: 0;
padding: 0;
text-align: center;
}
div,p,table,th,td {
list-style: none;
margin: 0;
padding: 0;
color: #333;
font-size: 12px;
font-family: dotum, Verdana, Arial, Helvetica, AppleGothic, sans-serif;
}
#testIframe {
margin-left: 10px;
}
</style>
<SCRIPT type="text/javascript">
var zTree;
var demoIframe;
var setting = {
view : {
dblClickExpand : false,
showLine : true,
selectedMulti : false
},
data : {
simpleData : {
enable : true,
idKey : "id",
pIdKey : "pId",
rootPId : ""
}
},
callback : {
beforeClick : function(treeId, treeNode) {
var zTree = $.fn.zTree.getZTreeObj("tree");
if (treeNode.isParent) {
zTree.expandNode(treeNode);
return false;
} else {
demoIframe.attr("src", treeNode.file);
return true;
}
}
}
};
var zNodes = [
{
id : 1,
pId : 0,
name : " ",
open : false,
}, {
id : 101,
pId : 1,
name : " ",
}, {
id : 102,
pId : 1,
name : " ",
file : "2.html"
}, {
id : 201,
pId : 101,
name : " radio ",
file : "1.html"
},
{
id : 2,
pId : 0,
name : " ",
open : false,
}, {
id:21,
pId:2,
name:" ",
file:"1.html"
}];
$(document).ready(function() {
var t = $("#tree");
t = $.fn.zTree.init(t, setting, zNodes);
demoIframe = $("#testIframe");
demoIframe.bind("load", loadReady);
var zTree = $.fn.zTree.getZTreeObj("tree");
zTree.selectNode(zTree.getNodeByParam("id", 101));
});
function loadReady() {
var bodyH = demoIframe.contents().find("body").get(0).scrollHeight,
htmlH = demoIframe.contents().find("html").get(0).scrollHeight,
maxH = Math.max(bodyH, htmlH),
minH = Math.min(bodyH, htmlH),
h = demoIframe.height() >= maxH ? minH : maxH;
if (h < 530)
h = 530;
demoIframe.height(h);
}
</SCRIPT>
</head>
<body>
<TABLE border=0 height=600px align=left>
<TR>
<TD width=260px align=left valign=top style="BORDER-RIGHT: #999999 1px dashed">
<ul id="tree" class="ztree" style="width:260px; overflow:auto;"></ul>
</TD>
<TD width=770px align=left valign=top><IFRAME ID="testIframe"
Name="testIframe" FRAMEBORDER=0 SCROLLING=AUTO width=100%
height=600px SRC="1.html"></IFRAME></TD>
</TR>
</TABLE>
</body>
</html>
프로젝트 다운로드 완료 주소http://download.csdn.net/detail/whzhaochao/7228709
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
가장 간단한 zTree 응용 사례텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.