Example of an iframe call to a parent page function
- 2020-03-30 03:34:32
- OfStack
window.parent.xxxxx();//xxxxx() Represents the parent page method
The details are as follows, including the right-click and click events for easyUI
The parent. The JSP
Body part code
<body class="easyui-layout">
<!-- On the left side of the directory -->
<div
data-options="region:'west',split:true,title:' The theme ',iconCls:'icon-arrowIn'"
style="width: 270px; background: #efefef">
<!-- Directory number -->
<ul id="tree" class="easyui-tree"></ul>
</div>
<input type="hidden" value="${param.type }" id="themeType"/>
<!-- On the right side of the form -->
<div
data-options="region:'center',title:' content ',iconCls:'icon-arrowOut'" style="overflow: hidden">
<iframe name="leftIframe" id="leftIframe" src="" frameborder="0" height="100%" width="100%"></iframe>
</div>
<!-- Right-click menu -->
<div id=rightCliMean class="easyui-menu" style="width:120px;">
<div onclick="updateTheme();" data-options="iconCls:'icon-edit'" > Modify the </div>
<div onclick="removeObjectNode();" data-options="iconCls:'icon-tip'" > delete </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 == ' The default theme '){
$.messager.alert(" Prompt information "," The default theme cannot be manipulated !","warning");
return false;
}
$('#rightCliMean').menu('show',{
left: e.pageX,
top: e.pageY
});
}
},
onClick:function(node) {//Single event
var type = node.attributes.type;
if("Schema" == type){
var themeType = $("#themeType").val();
$('#leftIframe').attr('src', 'xxxx.action');
return;
}
}
});
}
child.jsp
$(function(){
window.parent.loadTree();
})