父子页面传值
来源:互联网 发布:阿里云邮箱登录个人版 编辑:程序博客网 时间:2024/06/05 18:21
父页面:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>parent.html</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <!--<link rel="stylesheet" type="text/css" href="./styles.css">--> <script type="text/javascript"> function openWin() { var style = "width=300,height=400,location=no,directories=no,toolbar=no,status=no,menubar=no,resizable=no,scrollbars=no"; window.open("child.html","open other window",style); } function setValue(name,hname) { document.getElementById("name").value = name; document.getElementById("hname").value = hname; } </script> </head> <body> name:<input type="text" id="name"/><a href="#" onclick="openWin()">please click it</a> <input type="hidden" name="name" id="hname"/> </body></html>
子页面
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>child.html</title> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="this is my page"> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <!--<link rel="stylesheet" type="text/css" href="./styles.css">--> <script type="text/javascript"> function selectedThis(obj) { var name = obj.value; var hname = obj.id; window.opener.setValue(name,hname); //调用父窗口的方法进行传值 window.opener = null; window.close(); } </script> </head> <body> 请选择名称:<br/> <input type="radio" name="name" id="name1" value="名称1" onclick="selectedThis(this)"/>名称1 <input type="radio" name="name" id="name2" value="名称2" onclick="selectedThis(this)"/>名称2 <input type="radio" name="name" id="name3" value="名称3" onclick="selectedThis(this)"/>名称3 <br/> <input type="radio" name="name" id="name4" value="名称4" onclick="selectedThis(this)"/>名称4 <input type="radio" name="name" id="name5" value="名称5" onclick="selectedThis(this)"/>名称5 <input type="radio" name="name" id="name6" value="名称6" onclick="selectedThis(this)"/>名称6 </body></html>
总结:这个在360浏览器中测试不理解,但在IE可以测试成功。在父页面中主要写入
window.open("child.html","open other window",style);
function setValue(name,hname)
在子页面中调用父类的方法
window.opener.setValue(name,hname); //调用父窗口的方法进行传值 window.opener = null; window.close();
0 0
- 父子页面传值
- 父子页面传值
- 父子页面相互传值
- js父子页面传值
- iframe父子页面传值
- jsp父子页面传值
- zDialog传值父子页面传值
- 关于父子页面的传值
- [Ext.Net]父子页面传值问题
- 父子页面传值的问题
- 开发中父子页面传值问题
- 使用MUI实现父子页面传值
- window.open() 父子页面的传参&传值问题
- window.open() 父子页面的传参&传值问题
- js父子页面模态窗口传值
- 用open或showModalDialog实现父子页面传值
- 打开模式窗,在父子页面传值
- showModalDialog父子页面的传值及子页面传完值自动关闭刷新父页面
- 【转载】一步步将vim改造成C/C++开发环境(IDE)
- 诚征书本封面啦
- 8 配接器
- Android SystemProperties设置/取得系统属性的用法总结
- C++拷贝构造函数
- 父子页面传值
- XML解析工具类
- 点球大战(模拟)
- android 使用开源工具ChkBugReport分析Bugreport
- 用GNS3模拟Cisco PIX
- 11款网站死链检测工具
- 利用Multigen Creator构建地形三维模型(CAD地形图--三维模型)
- 字符转码(转)
- 实现分页pagration的方法jquery(个人感觉用到了easyui貌似)