目的:
    一个新闻系统,父窗口的表单负责提交文字信息,表单旁边有一个“上传图片”按钮,点击这个按钮,弹出子窗口,子窗口负责上传图片,并把图片文件名返回到子窗口。我想让图片上传成功,返回图片文件名的时候,子窗口能够以<img src="xxx.gif">的形式返回到父窗口的“内容”文本框里面,如果文本框里面先有字符,则返回的是原有字符+返回值。   如果能够实现返回值插入到文本框的光标所在位置就更好了。下面是简单的模拟情景,希望前辈能够帮忙(我的分数不多了,以后可以补),能够实现把chird.aspx里面文本框的字符返回并添加到button的文本框里面就可以了:button.aspx
<%@ Page language="c#" Codebehind="button.aspx.cs" AutoEventWireup="false" Inherits="cibs.button" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>button</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<FONT face="宋体">
<asp:Button id="Button2" style="Z-INDEX: 101; LEFT: 360px; POSITION: absolute; TOP: 88px" runat="server"
Text="Button"></asp:Button>
<asp:TextBox id="TextBox1" style="Z-INDEX: 102; LEFT: 264px; POSITION: absolute; TOP: 144px"
runat="server" Width="264px" Height="144px" TextMode="MultiLine"></asp:TextBox></FONT>
</form>
</body>
</HTML>button.aspx.cs
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;namespace cibs
{
/// <summary>
/// button 的摘要说明。
/// </summary>
public class button : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Button2;

private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(!IsPostBack)
{
OpenPopUp(Button2,"chird.aspx","",250,0,450,300);
} } public static void OpenPopUp(System.Web.UI.WebControls.WebControl opener,string PagePath,string windowName,int Top,int Left,int width,int height)
{
string clientScript;
string windowAttribs;
windowAttribs = "left=" + Left.ToString() + "px," +
"top=" + Top.ToString() + "px," +
"width=" + width.ToString() + "px," + 
"height=" + height.ToString() + "px," +
"left='+((screen.width -" + width.ToString()+ ") / 2)+',";
clientScript = "window.open('"+PagePath+ "','"+   
windowName + "','"+ windowAttribs + "');return false;";
opener.Attributes.Add("onClick", clientScript);
}  #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{    
this.Load += new System.EventHandler(this.Page_Load); }
#endregion
}
}chird.aspx
<%@ Page language="c#" Codebehind="chird.aspx.cs" AutoEventWireup="false" Inherits="cibs.chird" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>chird</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<FONT face="宋体">
<asp:TextBox id="TextBox1" style="Z-INDEX: 101; LEFT: 48px; POSITION: absolute; TOP: 80px" runat="server"
Width="208px" Height="24px">&lt;img src=&quot;xxx.gif&quot;&gt;</asp:TextBox>
<asp:Button id="Button1" style="Z-INDEX: 102; LEFT: 280px; POSITION: absolute; TOP: 80px" runat="server"
Width="64px" Text="Button"></asp:Button></FONT>
</form>
</body>
</HTML>
chird.aspx.cs
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;namespace cibs
{
/// <summary>
/// chird 的摘要说明。
/// </summary>
public class chird : System.Web.UI.Page
{
protected System.Web.UI.WebControls.TextBox TextBox1;
protected System.Web.UI.WebControls.Button Button1;

private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}

/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{    
this.Button1.Click += new System.EventHandler(this.Button1_Click);
this.Load += new System.EventHandler(this.Page_Load); }
#endregion private void Button1_Click(object sender, System.EventArgs e)
{
}
}
}