window.open() 父子页面的传参&传值问题
来源:互联网 发布:重复歌曲删除软件 编辑:程序博客网 时间:2024/06/05 19:43
window.open() 传参问题:
父页面中:
url页面拿父页面的xx元素赋值
window.open() 传值问题(参考:http://www.cnblogs.com/gavindou/archive/2008/04/09/1143858.html):
a.html(父)
注意:window.open("b.html","","modal=yes,width=500,height=500,resizable=no,scrollbars=no"); 中的第3个参数一定要有 modal=yes
b.html(子)
父页面中:
- window.open('url', '', 'resizable=1, menuBar=0, toolBar=0, scrollbars=yes, Status=yes, resizable=1');
url页面拿父页面的xx元素赋值
- opener.document.getElementById("xx").value="newValue";
- if(window.opener){//判断是否有父窗口,即打开本页面的窗口
- window.opener.location.reload();//刷新父窗口
- window.opener.close(); //关闭父窗口
- }
window.open() 传值问题(参考:http://www.cnblogs.com/gavindou/archive/2008/04/09/1143858.html):
a.html(父)
注意:window.open("b.html","","modal=yes,width=500,height=500,resizable=no,scrollbars=no"); 中的第3个参数一定要有 modal=yes
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title>a.html文档</title>
- <script type="text/javascript">
- function openstr()
- {
- window.open("b.html","","modal=yes,width=500,height=500,resizable=no,scrollbars=no");
- }
- </script>
- </head>
- <body>
- <form id="form1" name="form1" method="post" action="">
- <label>
- <select name="txtselect" id="txtselect">
- </select>
- </label>
- <label>
- <input type="button" name="Submit" value="打开子窗口" onclick="openstr()" />
- </label>
- </form>
- </body>
- </html>
b.html(子)
- <html >
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title>b.html文档</title>
- <script type="text/javascript">
- function ClickOk()
- {
- var t=document.Edit;
- var color=t.color.value;
- if(color==null||color=="填写颜色") return(false);
- var oOption = window.opener.document.createElement('OPTION');
- oOption.text=document.getElementById("color").value;
- oOption.value=document.getElementById("color").value;
- //检查浏览器类型
- var bname = navigator.appName;
- if (bname.search(/netscape/i) == 0)
- {
- window.opener.document.getElementById("txtselect").appendChild(oOption);
- }
- else if (bname.search(/microsoft/i) == 0)
- {
- window.opener.document.all.txtselect.add(oOption);
- }
- else
- {
- }
- window.close();
- }
- </script>
- </head>
- <body>
- <table border="0" cellpadding="0" cellspacing="2" align="center" width="300">
- <form name="Edit" id="Edit">
- <tr>
- <td width="30" align="right" height="30">color:</td>
- <td height="30"><input type="text" name="color" id="color" value="填写颜色" /></td>
- <td width="56" align="center" height="30"><input " type="button" name="bntOk" value="确认" onclick="ClickOk();" /> </td>
- </tr>
- </form>
- </table>
- </body>
- </html>
- var url = '/xxx/xx.jsp?yearNum='+yearNum;
- if (typeof window.ActiveXObject != 'undefined') { // 支持IE浏览器
- var weekNum=document.getElementById("weekNum").value;
- var arguments = new Array();
- arguments[0] = weekNum;
- var returnValue = window.showModalDialog(url,arguments,'dialogHeight:500px;dialogWidth:380px;dialogTop:300px; dialogLeft:500px;center:yes;scroll:yes;status:no;resizable:no;edge:raised;help:no;unadorned:yes');
- if(returnValue!=null && returnValue[0]){
- document.getElementById("weekNum").value=returnValue[1];
- document.getElementById("beginDate").value=returnValue[2];
- document.getElementById("endDate").value=returnValue[3];
- }
- }
- else if((typeof document.implementation != 'undefined')
- &&(typeof document.implementation.createDocument!='undefined')) { // 支持Mozilla浏览器
- window.open(url,'weekNum','modal=yes,menubar=0,status=0,toolbar=0,scrollbars=1,resizable=1,width=400px,height=500px,top=300,left=500');
- }
0 0
- window.open() 父子页面的传参&传值问题
- window.open() 父子页面的传参&传值问题
- 用window.open方法实现子页面调用的父子页面传值
- window.open打开的父子页面通信问题
- window.open()父子窗口传值
- 父子页面传值的问题
- window.open打开的页面向父页面传值
- 用open或showModalDialog实现父子页面传值
- [Ext.Net]父子页面传值问题
- 开发中父子页面传值问题
- window.open父子窗口数据传递问题
- 父子页面传值
- 父子页面传值
- jsp中的window.open和window.showModalDialog的弹出页面以及传参
- window.open子页面传值给父页面
- window.open 通过子页面向父页面传值
- window.open 父页面向子页面传值
- 关于父子页面的传值
- 8.5.2 Optimizing InnoDB Transaction Management
- mdev 自动创建设备结点
- eclipse中一些常见svn图标的含义,超全的
- 代码调用存储过程超时,但数据库 执行 秒速
- 成员变量和局部变量的区别
- window.open() 父子页面的传参&传值问题
- 摇一摇 怎么实现
- 记录个小问题:解决SSH中的Host key verification failed
- jqueryeasy ui 的 accordion 和 tabs控件
- 线段树练习之——分块解法
- Android的TextView使用Html来处理图片显示、字体样式、超链接等
- ajax跨域访问服务器
- mysql 连接url中useUnicode=true&characterEncoding=UTF-8 的作用
- Xcode技巧 - 3