1. First, the parent page opens the window with window.open
<%@ page language= "C #" autoeventwireup= "true" codebehind= "WebForm3.aspx.cs" inherits= "WEBAPPLICATION17.WEBFORM3" %>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title></title>
<script type= "Text/javascript" >
function Openchild () {
var k = window.open (' webform2.aspx?id=110&id1=120&id3=130 ', ' newwindow ', ' height=100,width=400,top=0,left=0 , Toolbar=no,menubar=no,scrollbars=no, Resizable=no,location=no, Status=no ');
window.showModalDialog ("/webform2.aspx", "obj", "dialogwidth:335px;status:no;dialogheight:300px");
}
</script>
<body>
<form id= "Form1" runat= "Server" >
<div>
<input type= "text" id= "txt10" name= "txt10"/>
<input type= "text" id= "Txt9" name= "Txt9"/>
<input type= "text" id= "txt11" name= "txt11"/>
<input type= "button" id= "Btn1" name= "BTN1" value= "Submit" onclick= "Openchild ()"/>
</div>
</form>
</body>
2. This is a sub-page
<%@ page language= "C #" autoeventwireup= "true" codebehind= "WebForm2.aspx.cs" inherits= "Webapplication17.webform2" %>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<title></title>
<script type= "Text/javascript" >
Window.onload = function () {
var k = Window.opener;
document.getElementById ("Txt1"). Value = K.document.getelementbyid ("txt10"). Value;
var url = location.search;
if (Url.indexof ("ID3")!=-1) {
Alert ("URL id3");
}
var therequest = new Object ();
if (Url.indexof ("?")! =-1) {
var str = URL.SUBSTR (1);
STRs = Str.split ("&");
for (var i = 0; i < strs.length; i++) {
Therequest[strs[i].split ("=") [0]] = (strs[i].split ("=") [1]);
}
}
};
function Setfather () {
Passing values to the parent window space
var k = Window.opener;
K.document.getelementbyid ("Txt10"). Value =
document.getElementById ("Txt1"). Value;
}
Sets the value returned to the parent window
function Retrunvalue () {
var s =
document.getElementById ("Txt2"). Value;
Window.returnvalue = s;
Window.close ();
}
</script>
<body>
<form name= "abc" runat= "Server" >
<input type= "text" id= "txt1" name= "Txt1"/>
<input type= "text" id= "txt2" name= "Txt2"/>
<input type= "button" id= "Btn1" name= "BTN1" value= "Submit" onclick= "Setfather ()"/>
</form>
</body>
JS Parent-child window value and the current page in the JS foreground how to get URL parameters