相忘于江湖

不抛弃,不放弃... 请给我勇敢,改变可以改变的;请给我坚强,接受不可以改变的;请给我智慧,分辨这两者。

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
父窗口弹出子窗口的 button处理事件:
private void Button1_Click(object sender, System.EventArgs e)
  {
   Response.Write("<script language=javascript>window.open('WebForm1.aspx','', 'alwaysRaised=1,dependent=1,resizable=0,scrollbars,width=450,height=550');</script>");
  }
父窗口html代码添加如下javascript代码
<script language="javascript">
function refresh()
{
this.location = this.location;
}
</script>
子窗口关闭窗口的 button处理事件:
private void Button1_Click(object sender, System.EventArgs e)
{
StringBuilder scriptString = new StringBuilder();
scriptString.Append("<script language = javascript>");
scriptString.Append("window.opener.refresh();");

scriptString.Append( " window.focus();" );
scriptString.Append( " window.opener=null;" );
scriptString.Append( " window.close(); " );

scriptString.Append("</"+"script>");
Response.Write(scriptString.ToString());

// Response.Write("<script language=javascript>window.close()</script>");
}
posted on 2010-07-17 15:34  playman0211  阅读(320)  评论(0编辑  收藏  举报