------------------------------B 頁-----------------------------------------------------
<script language="JavaScript">
function subvalue()
{
var mystr=document.all ["txtSelected"].value ;
var mystr1=document.all["txtSelectedAD"].value;
window.opener.document.all["Text3"].value=mystr ;
window.opener.document.all["TextAD"].value=mystr1;
window.close ();
}
</script><input id="BtnSubmit" onclick="subvalue()" style="z-index: 108; left: 206px; width: 76px; position: absolute;
top: 356px" type="button" value="確 定" />
------------------------------A 頁----------------------------------------------------- <input id="Button1" onclick="MyWin=window.open('b.aspx','sssddsd','Width=500Px;Height=500px;status=no;help=no;');" style="z-index: 101; left: 667px; width: 59px; position: absolute;
top: 60px" type="button" value="選 擇" />
<script language="JavaScript">
function subvalue()
{
var mystr=document.all ["txtSelected"].value ;
var mystr1=document.all["txtSelectedAD"].value;
window.opener.document.all["Text3"].value=mystr ;
window.opener.document.all["TextAD"].value=mystr1;
window.close ();
}
</script><input id="BtnSubmit" onclick="subvalue()" style="z-index: 108; left: 206px; width: 76px; position: absolute;
top: 356px" type="button" value="確 定" />
------------------------------A 頁----------------------------------------------------- <input id="Button1" onclick="MyWin=window.open('b.aspx','sssddsd','Width=500Px;Height=500px;status=no;help=no;');" style="z-index: 101; left: 667px; width: 59px; position: absolute;
top: 60px" type="button" value="選 擇" />
上面说的是C/S的。我的是B/S的
况且我说的是用JS
这样可以,但是如果用window.showModalDialog()打开的话,就不行
--------a页面-----------------
<script language=javascript>
function fnA()
{
temp= window.showModalDialog("b.aspx",window);
document.getElementById("t3").value = temp;
alert(document.getElementById("HFReceiver").value);
}
</script> <form id="form1" runat="server">
返回值:
<input type = "text" id= "t3" />
<asp:HiddenField ID="HFReceiver" runat="server" />
</div>
</form>----------------b页面--------------
<script language =javascript>
function fun(){
var testId = document.getElementById("tt").value;
window.dialogArguments.document.getElementById("t2").value = testId;
window.dialogArguments.document.form1.HFReceiver.value = "t1";//可以修改a里面的控件的值;
window.close();
}
</script> <form id="form1" runat="server">
<div>
<input type=text id = "tt" value = "Hello ZiFeng"/>
<input id="Button1" onclick="fun()" type="button" value="button" />
</div>
</form>
好的。谢谢兄弟。还有一个问题怎么关闭showModalDialog)打开的窗口。用window.close()好象不行 同时也要以参考
http://topic.csdn.net/t/20040915/18/3376113.html
http://topic.csdn.net/t/20031119/08/2470334.html