发布网友 发布时间:2022-04-22 14:05
共2个回答
热心网友 时间:2022-04-22 17:55
<script type="text/javascript">
function getChildren(){
var node = $('#tt1').tree('getSelected'); //tt1是你的树的id
if (node){
alert(“有子节点");
} else {
alert("无子节点");
}
}
</script>
<ul id="tt1" class="easyui-tree" animate="true" dnd="false">
<li>
<span>Folder</span>
<ul>
<li state="closed">
<span>Sub Folder 1</span>
<ul>
<li>
<span><a href="">File 11</a></span>
</li>
<li>
<span>File 12</span>
</li>
<li>
<span>File 13</span>
</li>
</ul>
</li>
<li>
<span>File 2</span>
</li>
<li>
<span>File 3</span>
</li>
<li>File 4</li>
<li>File 5</li>
</ul>
</li>
<li>
<span>File21</span>
</li>
</ul>
<a href="#" onclick="getChildren1()">getChildren1</a>
热心网友 时间:2022-04-22 19:13
$().ready(function(){
$('#TreeMenu').tree( {
checkbox : true,
cascadeCheck:false,
url : "fun!getTree.action?id=-1",
onBeforeExpand:function(node)
{
$.getJSON("fun!getTree.action?id="+node.id,function(nodes){
$('#TreeMenu').tree('append', {
parent:node.target,
data:nodes
});
});
}
});
});