window.parent.xxxxx();//xxxxx()代表父頁面方法
具體列子如下,其中包括easyUI的右鍵和單擊事件
parent.jsp
body部分代碼
<body class="easyui-layout">
<!-- 左側目錄 -->
<div
data-options="region:'west',split:true,title:'主題',iconCls:'icon-arrowIn'"
style="width: 270px; background: #efefef">
<!-- 目錄數 -->
<ul id="tree" class="easyui-tree"></ul>
</div>
<input type="hidden" value="${param.type }" id="themeType"/>
<!-- 右側窗體 -->
<div
data-options="region:'center',title:'內容顯示',iconCls:'icon-arrowOut'" style="overflow: hidden">
<iframe name="leftIframe" id="leftIframe" src="" frameborder="0" height="100%" width="100%"></iframe>
</div>
<!-- 右鍵菜單 -->
<div id=rightCliMean class="easyui-menu" style="width:120px;">
<div onclick="updateTheme();" data-options="iconCls:'icon-edit'" >修改</div>
<div onclick="removeObjectNode();" data-options="iconCls:'icon-tip'" >刪除</div>
</div>
<script type="text/javascript">
loadTree();
</script>
</body>
js部分:
function loadTree() {
$('#tree').tree( {
url : 'xxxxx.action,
animate : true,
lines : true,
onContextMenu : function(e, node) {
e.preventDefault();
$(this).tree('select', node.target);
/**
* 不可以對根節點(默認主題)進行操作
*/
var parent = $(this).tree('getParent',node.target);
if(parent){
if(node.text == '默認主題'){
$.messager.alert("提示信息","默認主題不能進行操作!","warning");
return false;
}
$('#rightCliMean').menu('show',{
left: e.pageX,
top: e.pageY
});
}
},
onClick:function(node) {//單機事件
var type = node.attributes.type;
if("Schema" == type){
var themeType = $("#themeType").val();
$('#leftIframe').attr('src', 'xxxx.action');
return;
}
}
});
}
child.jsp
/**
* 刷新左側主題
*/
$(function(){
window.parent.loadTree();
})