Asp.net window.open弹出子窗体,刷新主窗体

来源:互联网 发布:电脑淘宝网页打不开 编辑:程序博客网 时间:2024/05/22 01:55

 首先,打开子窗体的方法,从后台打开
Response.Write("<script>window.open('××.aspx',','resizable,status, width=500,height=500,none,left=300,top=250,dependent=1');</script");

然后再在打开的窗体,也就是xx.aspx子窗体的按钮事件中添加链接:
 Response.Write("<script>alert('添加成功');window.opener.location.replace(opener.location);window.close();</script>");
就可以回来父窗体。


说明:这里的主要返回的方法是window.opener.location.replace(opener.location);,返回的窗体就是opener.location,还可以指定任何窗体 名称,如window.opener.location.replace(a.aspx);,这样你就会回来 a.aspx页面并刷新 a.aspx页面