easyUi弹出window窗口传值与调用父页面的方法,子页面给父页面赋值
<!-- 父页面 -->
- <!DOCTYPE html PUBLIC "-/W3C/DTD HTML 4.01 Transitional/EN" "http:/www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>父页面</title>
- <!-- 引用easyUi的文件 -->
- <link rel="stylesheet" type="text/css" href="jquery-easyui/themes/default/easyui.css">
- <link rel="stylesheet" type="text/css" href="jquery-easyui/themes/icon.css">
- <script type="text/javascript" src="jquery-easyui/jquery.min.js"></script>
- <script type="text/javascript" src="jquery-easyui/jquery.easyui.min.js"></script>
- <!-- 国际化 -->
- <script type="text/javascript" src="jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
- </head>
- <body>
- <a href="javascript:void(0)" onclick="openWin();">点击打开隐藏的window窗口</a>
- <!--隐藏的文本框-->
- <div id="win" class="easyui-window" title="My Window" style="width:600px;height:400px" closed="true"
- data-options="iconCls:'icon-save',modal:true">
- <div data-options="region:'north',title:'North Title',split:true" style="height:50px;">
- <a href="javascript:void(0)" onclick="wen('son.html')">子页面son.html</a>
- <input type="button" value="给子页面赋值" onclick="assgVal();" />
- <input type="text" name="fatherId" id="fatherId" value="父页面的文本框" /> <br/>
- <input type="text" name="fatherText" id="fatherText" value="给子页面赋的值!" />
- </div>
- <div id="centers" data-options="region:'center',title:'center title'" style="padding:5px;background:#eee;height:90%">
- 引用外部html文件
- </div>
- </div>
- <script type="text/javascript">
- //打开隐藏的win窗口
- function openWin(){
- $("#win").window("open");
- }
- //给子页面的文本框赋值
- function assgVal(){
- var fatherText = $("#fatherText").val();
- $('#son').contents().find("#sonId").val(fatherText);
- }
- /* 引用子页面index1.html */
- function wen(src){
- var hrefs = "<iframe id='son' src='" + src + "' allowTransparency='true' style='border:0;width:99%;height:99%;padding-left:2px;' frameBorder='0'></iframe>";
- $("#centers").html(hrefs);
- }
- //关闭window窗口
- function closeWin(){
- $("#win").window("close");
- }
- </script>
- </body>
- </html>
<!-- 子页面 -->
- <!DOCTYPE html PUBLIC "-/W3C/DTD HTML 4.01 Transitional/EN" "http:/www.w3.org/TR/html4/loose.dtd">
- <html>
- <head>
- <title>子页面</title>
- <!-- 引用easyUi的文件 -->
- <link rel="stylesheet" type="text/css" href="jquery-easyui/themes/default/easyui.css">
- <link rel="stylesheet" type="text/css" href="jquery-easyui/themes/icon.css">
- <script type="text/javascript" src="jquery-easyui/jquery.min.js"></script>
- <script type="text/javascript" src="jquery-easyui/jquery.easyui.min.js"></script>
- <!-- 国际化 -->
- <script type="text/javascript" src="jquery-easyui/locale/easyui-lang-zh_CN.js"></script>
- </head>
- <body>
- <h1>你好,这是子页面</h1>
- <input type="text" name="sonId" id="sonId" value="" /><br/>
- <input type="text" name="sonText" id="sonText" value="给父页面的文本框赋值" />
- <button onclick="farassgVal();">给父页面的文本框赋值</button>
- </body>
- <script type="text/javascript">
- //调用父页面的赋值方法
- $(window.parent.assgVal());
- $(function(){
- alert($("#sonId").val());
- //调用父页面的关闭win窗口的方法
- //window.parent.closeWin();
- });
- //给父页面的文本框赋值
- function farassgVal(){
- var sonText = $("#sonText").val();
- $(window.parent.$("#fatherId").val(sonText));
- }
- </script>
- </html>
第一:
第二:
第三:
第四:
第五:
代码下载地址:
easyUi弹出window窗口传值与调用父页面的方法,子页面给父页面赋值的更多相关文章
- Easyui 弹出加载中的遮罩的两种方法
第一种: //弹出加载层function load() { $("<div class=\"datagrid-mask\"></div> ...
- ajax回调中window.open弹出的窗口会被浏览器拦截的解决方法
存在问题:处理页面ajax请求过程中,异步请求成功后需要新开窗口打开 url,使用的是 window.open() 方法 来实现,最终都被浏览器拦截了.不会跳到对应的页面,如下 原因:浏览器之所以拦截 ...
- 解决弹出的窗口window.open会被浏览器阻止的问题(自定义open方法)
由于在使用window.open时,在很多情况下,弹出的窗口会被浏览器阻止,但若是使用a链接target='_blank',则不会,基于这一特点,自己封装了一个open方法: function ope ...
- Windows下Java调用BAT批处理不弹出cmd窗口
常规Windows下Java调用BAT方式肯定会弹出cmd窗口 Runtime.getRuntime().exec("cmd.exe /C start D:\\test.bat") ...
- JS设置弹出小窗口。
经常上网的朋友可能会到过这样一些网站,一进入首页立刻会弹出一个窗口,或者按一个连接或按钮弹出,通常在这个窗口里会显示一些注意事项.版权信息.警告.欢迎光顾之类的话或者作者想要特别提示的信息.其实制作这 ...
- JS 弹出模态窗口解决方案
最近在项目中使用弹出模态窗口,功能要求: (1)模态窗口选择项目 (2)支持选择返回事件处理 在IE中有showModalDialog 方法,可以很好的解决该问题,但是在Chrome中和FF中就有问题 ...
- 创建一个弹出DIV窗口
创建一个弹出DIV窗口 摘自: http://www.cnblogs.com/TivonStone/archive/2012/03/20/2407919.html 创建一个弹出DIV窗口可能是现在 ...
- QUI操作超时弹出登录窗口登录的处理方式
在使用QUI开发的业务系统中,如果长时间没操作,session过期后,再次操作系统超时会自动跳转到登陆页面,如果当前有一些操作没有保存,需要重新登录后再次填写信息,用户体验很不好! 为了避免超时后页面 ...
- js实现第一次打开网页弹出指定窗口(常用功能封装很好用)
js实现第一次打开网页弹出指定窗口(常用功能封装很好用) 一.总结 1.常用功能封装:之前封装的cookie的操作函数非常好用,我自己也可以这么搞 二.js实现第一次打开网页弹出指定窗口 练习1:第一 ...
随机推荐
- 1118 Birds in Forest (25 分)
1118 Birds in Forest (25 分) Some scientists took pictures of thousands of birds in a forest. Assume ...
- Python3中的赋值操作、浅拷贝与深拷贝
一:关于赋值操作与浅拷贝 1.变量的赋值 首先以一个例子来说明一下:定义变量a = 1,使b = a.开始的情况下打印a与b都为1(显而易见,哈哈) 但是接下来,我们做一下改动,令 a = 222,再 ...
- google最新的书签导入导出
1.google浏览器地址栏最右边,自定义及控制--->书签----->书签管理器 2. 右上角,有整理图标, 3.点击按钮即可导入导出书签
- centos7 安装pip+python3.6
centos7安装pip 1.执行:yum install python-pip 若没有python-pip包,先执行:yum -y install epel-release,再执行yum insta ...
- 过滤器Filter的四种拦截方式
过滤器有四种拦截方式!分别是:REQUEST.FORWARD.INCLUDE.ERROR. REQUEST: 直接访问目标资源时执行过滤器.包括:在地址栏中直接访问.表单提交.超链接.重定向,只要在地 ...
- Device supprts x86,armeabi-v7a,but APK only aupports armeabi;模拟机不能运行。
在真机可以运行,模拟机却不可以: 这个是模拟机: 修改: defaultConfig { ndk{ abiFilters "armeabi" } } 为: defaultConfi ...
- android:clipChildren属性,子布局超出父布局;
是否允许子View超出父View的范围,Boolean型true .false ,默认true不允许: android:clipChildren="true":如下 android ...
- shell脚本选择LOG里面特定的行,生成新文件并rsync上传
rsync.sh #!/bin/bash tool_path=$(cd `dirname $`; pwd) eval `cat ${tool_path}/conf.properties` rsync_ ...
- windows下maven的安装
1.下载maven的zip包,下载地址:http://maven.apache.org/download.cgi 2.解压到F:\maven 3.修改环境变量: MAVEN_HOME:F:\maven ...
- nginx安装环境
1 nginx安装环境 nginx是C语言开发,建议在linux上运行,本教程使用Centos6.5作为安装环境. n gcc 安装nginx需要先将官网下载的源码进行编译,编译依赖gcc环境,如果没 ...