首先,打开子窗体的方法,从后台打开
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页面
本文介绍了一种通过JavaScript实现子窗体打开及返回父窗体的方法。具体步骤为:首先,在后台使用Response.Write打开子窗体;接着,在子窗体中的按钮事件里添加链接,使用window.opener.location.replace()使页面回到父窗体并刷新。
608

被折叠的 条评论
为什么被折叠?



