iframe調(diào)用父頁面函數(shù)示例詳解
更新時間:2014年07月17日 17:19:16 投稿:whsnow
這篇文章主要介紹了iframe如何調(diào)用父頁面函數(shù),下面有個不錯的示例,大家可以參考下
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é)點(默認主題)進行操作
*/
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
/**
* 刷新左側(cè)主題
*/
$(function(){
window.parent.loadTree();
})
相關(guān)文章
javascript制作網(wǎng)頁圖片上實現(xiàn)下雨效果
這里給大家分享的是一則使用javascript實現(xiàn)在網(wǎng)頁圖片上下雨的特效,效果非常炫酷,推薦給小伙伴們。2015-02-02
layuimini框架實現(xiàn)點擊菜單欄回到起始頁的解決方案
這篇文章主要介紹了layuimini框架實現(xiàn)點擊菜單欄回到起始頁的解決方案,本文通過圖文示例代碼給大家介紹的非常詳細,感興趣的朋友跟隨小編一起看看吧2024-06-06
各瀏覽器對document.getElementById等方法的實現(xiàn)差異解析
這篇文章主要是對各瀏覽器對document.getElementById等方法的實現(xiàn)差異進行了詳細的分析介紹,需要的朋友可以過來參考下,希望對大家有所幫助2013-12-12

