积极答复者
请教个刷新问题。

问题
-
vs2003.有两个页面,A和B,在A页面中点击,然后弹出B。
在B页面,点击按钮退出,并要刷新A的页面数据。
我在b页面时这样操作的:
Response.Write("<script>window.close()</script>");
Response.Write("<script>parent.location.href='day_work_search.aspx';</script>");
Response.Write("<script>window.opener.location.reload(); </script>");
好像都不成功。
如果只用这一句:Response.Write("<script>window.opener.location.reload(); </script>");
他又会有个提示:不重新发送信息,则无法刷新网页.....
请问怎么处理这个问题呢,谢谢- 已移动 Sheng Jiang 蒋晟Moderator 2009年7月17日 15:05 web开发问题 (发件人:Visual C#)
答案
-
你好,请参考
http://social.microsoft.com/Forums/zh-CN/295/thread/18cf2e1b-3342-480e-a34f-ddb430650aef
jon.valett@gmail.com- 已标记为答案 邹俊才Moderator 2009年7月20日 9:17
-
楼主,你好
如果你是要关闭B窗口,并且刷新A窗口。
那下面这样是可以的。
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Button2_Click(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "close", "close()", true); } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <script type="text/javascript" language="javascript"> function close() { if (window.opener) { window.opener.location.href = "GetCursorDemo.aspx"; window.opener.location.reload(); }window.close(); } </script> </head> <body> <form id="form1" runat="server"> <div> <h3>fafafa</h3> <asp:Button ID="Button2" runat="server" Text="Button2" onclick="Button2_Click" /> </div> </form> </body> </html>
Microsoft Online Community Support- 已标记为答案 邹俊才Moderator 2009年7月20日 9:17
-
ClientScript.RegisterClientScriptBlock(this.GetType(), "x", "window.opener.location.href='B.aspx';window.close();", true);
知识改变命运,奋斗成就人生!- 已标记为答案 邹俊才Moderator 2009年7月20日 9:17
全部回复
-
你好,请参考
http://social.microsoft.com/Forums/zh-CN/295/thread/18cf2e1b-3342-480e-a34f-ddb430650aef
jon.valett@gmail.com- 已标记为答案 邹俊才Moderator 2009年7月20日 9:17
-
ClientScript.RegisterClientScriptBlock(this.GetType(), "x", "window.opener.location.href='B.aspx';window.close();", true);
知识改变命运,奋斗成就人生!- 已标记为答案 邹俊才Moderator 2009年7月20日 9:17
-
楼主,你好
如果你是要关闭B窗口,并且刷新A窗口。
那下面这样是可以的。
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> protected void Button2_Click(object sender, EventArgs e) { ClientScript.RegisterStartupScript(this.GetType(), "close", "close()", true); } </script> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <script type="text/javascript" language="javascript"> function close() { if (window.opener) { window.opener.location.href = "GetCursorDemo.aspx"; window.opener.location.reload(); }window.close(); } </script> </head> <body> <form id="form1" runat="server"> <div> <h3>fafafa</h3> <asp:Button ID="Button2" runat="server" Text="Button2" onclick="Button2_Click" /> </div> </form> </body> </html>
Microsoft Online Community Support- 已标记为答案 邹俊才Moderator 2009年7月20日 9:17