iframe调用父页面函数示例详解
window.parent.xxxxx();//xxxxx()代表父页面方法
具体列子如下,其中包括easyUI的右键和单击事件
parent.jsp
body部分代码
<bodyclass="easyui-layout">
<!--左侧目录-->
<div
data-options="region:'west',split:true,title:'主题',iconCls:'icon-arrowIn'"
style="width:270px;background:#efefef">
<!--目录数-->
<ulid="tree"class="easyui-tree"></ul>
</div>
<inputtype="hidden"value="${param.type}"id="themeType"/>
<!--右侧窗体-->
<div
data-options="region:'center',title:'内容显示',iconCls:'icon-arrowOut'"style="overflow:hidden">
<iframename="leftIframe"id="leftIframe"src=""frameborder="0"height="100%"width="100%"></iframe>
</div>
<!--右键菜单-->
<divid=rightCliMeanclass="easyui-menu"style="width:120px;">
<divonclick="updateTheme();"data-options="iconCls:'icon-edit'">修改</div>
<divonclick="removeObjectNode();"data-options="iconCls:'icon-tip'">删除</div>
</div>
<scripttype="text/javascript">
loadTree();
</script>
</body>
js部分:
functionloadTree(){
$('#tree').tree({
url:'xxxxx.action,
animate:true,
lines:true,
onContextMenu:function(e,node){
e.preventDefault();
$(this).tree('select',node.target);
/**
*不可以对根节点(默认主题)进行操作
*/
varparent=$(this).tree('getParent',node.target);
if(parent){
if(node.text=='默认主题'){
$.messager.alert("提示信息","默认主题不能进行操作!","warning");
returnfalse;
}
$('#rightCliMean').menu('show',{
left:e.pageX,
top:e.pageY
});
}
},
onClick:function(node){//单机事件
vartype=node.attributes.type;
if("Schema"==type){
varthemeType=$("#themeType").val();
$('#leftIframe').attr('src','xxxx.action');
return;
}
}
});
}
child.jsp
/**
*刷新左侧主题
*/
$(function(){
window.parent.loadTree();
})热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下