jquery-easyui中单击节点显示的问题
我在asp页面中有这样一个函数
<link rel="stylesheet" href="css/css.css">
<link rel="stylesheet" type="text/css" href="jquery-easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="jquery-easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="jquery-easyui/demo.css">
<script type="text/javascript" src="jquery-easyui/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="jquery-easyui/jquery.easyui.min.js"></script>毕业论文
<script type="text/javascript">
function getSelected(){
var node = $('#tt').tree('getSelected');
if (node){
var s = node.text;
if (node.attributes){
s += ","+node.attributes.p1+","+node.attributes.p2;
}
alert(s);
}
}
</script>
<div style="margin:10px 0;">
<a href="#" class="easyui-linkbutton" onclick="collapseAll()">CollapseAll</a>
<a href="#" class="easyui-linkbutton" onclick="expandAll()">ExpandAll</a>
<a href="#" class="easyui-linkbutton" onclick="expandTo()">ExpandTo</a>
<a href="#" class="easyui-linkbutton" onclick="getSelected()">GetSelected</a>
</div>
<ul id="tt" class="easyui-tree" data-options="url:'jquery-easyui/demo/tree/tree_data1.json',animate:true"></ul>
现在我想不用点GetSelected按钮,而是直接点击树的节点就弹出对话框显示点击的节点名称呢!谢谢诶!
<ul id="tt" class="easyui-tree" data-options="url:'jquery-easyui/demo/tree/tree_data1.json',animate:true,onClick: function(node){var s=node.text;if (node.attributes)s += ','+node.attributes.p1+','+node.attributes.p2;alert(s);}"></ul>
增加onclick事件就行了