网页设计

iframe调用父页面的方法

时间:2025-01-27 11:19:59 网页设计 我要投稿
  • 相关推荐

iframe调用父页面的方法

  贵有恒何必三更眠五更起,最无益只怕一日曝十日寒。 以下是小编为大家搜索整理的iframe调用父页面的方法,希望能给大家带来帮助!更多精彩内容请及时关注我们应届毕业生考试网!

  1

 
window.parent.xxxxx();//xxxxx()代表父页面方法

  具体列子如下,其中包括easyUI的右键和单击事件

  parent.jsp

  body部分代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<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部分:

  ?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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();
})

【iframe调用父页面的方法】相关文章:

iframe调用父页面方法01-24

用js互相调用iframe页面的方法03-30

iframe子父页面调用实例05-18

iframe里的页面调用父窗口01-31

php调用父类方法08-04

Python中子类怎样调用父类方法02-17

在子类中应该如何调用父类的构造方法07-11

java调用的方法04-20

java调用的几个方法07-27