在A页面上放了3个控件,TEXTBOX1,TEXTBOX2和BUTTON
点击BUTTON后打开B页面
在B页面上放了GRIDVIEW控件,其中有编号和姓名两列内容,
在关闭B页面时如何将编号内容发送到TEXTBOX1中,
将姓名值发送到TEXTBOX2中.在网上查询的代码,可以打开B页了,但是不知道如何在关闭时将指定的值重新传给A页面的指定控件中.
<script language="javascript">
function DownDvasp(htmlurl)
{
var newwin = window.open(htmlurl, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'); return false;
}
</script>Button1.Attributes.Add("onClick", "javascript:DownDvasp('B.aspx')");各位帮忙看看如何解决呀?????
点击BUTTON后打开B页面
在B页面上放了GRIDVIEW控件,其中有编号和姓名两列内容,
在关闭B页面时如何将编号内容发送到TEXTBOX1中,
将姓名值发送到TEXTBOX2中.在网上查询的代码,可以打开B页了,但是不知道如何在关闭时将指定的值重新传给A页面的指定控件中.
<script language="javascript">
function DownDvasp(htmlurl)
{
var newwin = window.open(htmlurl, '', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no'); return false;
}
</script>Button1.Attributes.Add("onClick", "javascript:DownDvasp('B.aspx')");各位帮忙看看如何解决呀?????
在a页面 request["id"],request["name"]
win1.htm<HTML>
<HEAD>
<TITLE>showModalDialog窗口传值</TITLE>
<script language="JavaScript">
function showModal(){
rtn=window.showModalDialog('win2.htm');
s="";
for(elem in rtn){
alert(rtn[elem]);
s+=rtn[elem];
}
document.all["textarea"].value=s;
}
</script>
</HEAD>
<BODY BGCOLOR="antiquewhite"><FORM NAME="form1">
<textarea name="textarea"></textarea>
<P><INPUT TYPE="button" VALUE="Open a message window"
onClick = "showModal()"></BODY>
</HTML>win2.htm<HTML>
<HEAD>
<TITLE>Window object example: Window 2</TITLE>
</HEAD>
<BODY BGCOLOR="oldlace"
onUnload="collectRtn()">
<input name="textfield1" type="text" id="textfield1">
<input type="text" name="textfield2">
<input name="textfield3" type="text" id="textfield3">
<input name="textfield4" type="text" id="textfield4"><script language="javascript">
function collectRtn(){
s=new Array();
for(i=1;i<=4;i++){
tf=document.getElementById("textfield"+i);
s[i]=tf.value;
}
window.returnValue=s;
}
</script>
</BODY>
</HTML>
关于window.showModalDialog()
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" /></div>
</form>
<script language="javascript">
function DownDvasp(htmlurl)
{
var obj = window.showModalDialog("B.aspx",null,"dialogWidth=200px;dialogHeight=100px");
alert(obj.box1+ obj.box2);
document.getElementById("TextBox1").innerText = obj.box1;
document.getElementById("TextBox2").innerText= obj.box2; } </script> </body>
</html>B.aspx<%@ Page Language="C#" AutoEventWireup="true" CodeFile="B.aspx.cs" Inherits="多页面传值_B" %><!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 runat="server">
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
<!--function Button1_onclick() {
var obj = new Object();
obj.box1=document.getElementById("TextBox1").value;
obj.box2=document.getElementById("TextBox2").value;
alert(obj.box1+obj.box2);
window.returnValue = obj;
window.opener=null;
window.close();
}// -->
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<input id="Button1" type="button" value="button" language="javascript" onclick="return Button1_onclick()" /></div>
</form>
</body>
</html>