手机
当前位置:查字典教程网 >编程开发 >Javascript教程 >iframe调用父页面函数示例详解
iframe调用父页面函数示例详解
摘要:window.parent.xxxxx();//xxxxx()代表父页面方法具体列子如下,其中包括easyUI的右键和单击事件parent....

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

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

parent.jsp

body部分代码

<body> <> <div data-options="region:'west',split:true,title:'主题',iconCls:'icon-arrowIn'" > <> <ul id="tree"></ul> </div> <input type="hidden" value="${param.type }" id="themeType"/> <> <div data-options="region:'center',title:'内容显示',iconCls:'icon-arrowOut'"> <iframe name="leftIframe" id="leftIframe" src="" frameborder="0" height="100%" width="100%"></iframe> </div> <> <div id=rightCliMean> <div data-options="iconCls:'icon-edit'" >修改</div> <div 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); /** * 不可以对根节点(默认主题)进行操作 */ 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调用父页面函数示例详解】相关文章:

js同源策略详解

JavaScript Array对象详解

Js的Array数组对象详解

js常用函数 不错

jQuery 遍历函数详解

Jquery中基本选择器用法实例详解

JQuery中层次选择器用法实例详解

微信jssdk在iframe页面失效问题的解决措施

javascript原型模式用法实例详解

JavaScript的Date()方法使用详解

精品推荐
分类导航