iframe調(diào)用父頁面函數(shù)示例詳解
更新時(shí)間:2014年07月17日 17:19:16 投稿:whsnow
這篇文章主要介紹了iframe如何調(diào)用父頁面函數(shù),下面有個(gè)不錯(cuò)的示例,大家可以參考下
window.parent.xxxxx();//xxxxx()代表父頁面方法
具體列子如下,其中包括easyUI的右鍵和單擊事件
parent.jsp
body部分代碼
<body class="easyui-layout">
<!-- 左側(cè)目錄 -->
<div
data-options="region:'west',split:true,title:'主題',iconCls:'icon-arrowIn'"
style="width: 270px; background: #efefef">
<!-- 目錄數(shù) -->
<ul id="tree" class="easyui-tree"></ul>
</div>
<input type="hidden" value="${param.type }" id="themeType"/>
<!-- 右側(cè)窗體 -->
<div
data-options="region:'center',title:'內(nèi)容顯示',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);
/**
* 不可以對根節(jié)點(diǎn)(默認(rèn)主題)進(jìn)行操作
*/
var parent = $(this).tree('getParent',node.target);
if(parent){
if(node.text == '默認(rèn)主題'){
$.messager.alert("提示信息","默認(rèn)主題不能進(jìn)行操作!","warning");
return false;
}
$('#rightCliMean').menu('show',{
left: e.pageX,
top: e.pageY
});
}
},
onClick:function(node) {//單機(jī)事件
var type = node.attributes.type;
if("Schema" == type){
var themeType = $("#themeType").val();
$('#leftIframe').attr('src', 'xxxx.action');
return;
}
}
});
}
child.jsp
/**
* 刷新左側(cè)主題
*/
$(function(){
window.parent.loadTree();
})
相關(guān)文章
js中數(shù)組(Array)的排序(sort)注意事項(xiàng)說明
本篇文章主要是對js中數(shù)組(Array)的排序(sort)注意事項(xiàng)進(jìn)行了說明介紹,需要的朋友可以過來參考下,希望對大家有所幫助2014-01-01
layui-table表復(fù)選框勾選的所有行數(shù)據(jù)獲取的例子
今天小編就為大家分享一篇layui-table表復(fù)選框勾選的所有行數(shù)據(jù)獲取的例子,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-09-09
基于JavaScript判斷兩個(gè)對象內(nèi)容是否相等
這篇文章主要介紹了基于JavaScript判斷兩個(gè)對象內(nèi)容是否相等,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-01-01
javascript實(shí)現(xiàn)的文字加密解密
javascript實(shí)現(xiàn)的文字加密解密...2007-06-06
JavaScript實(shí)現(xiàn)檢查頁面上的廣告是否被AdBlock屏蔽了的方法
這篇文章主要介紹了JavaScript實(shí)現(xiàn)檢查頁面上的廣告是否被AdBlock屏蔽了的方法,其實(shí)就是利用JS檢測div的名稱和樣式名稱實(shí)現(xiàn),需要的朋友可以參考下2014-11-11
JavaScript下通過的XMLHttpRequest發(fā)送請求的代碼
JavaScript下通過的XMLHttpRequest發(fā)送請求的代碼,需要的朋友可以參考下。2011-06-06

