When writing ASP.Net programs, we often encounter the problem of page jumps. We often use Response.Redirect. If the customer wants to use prompts when jumping, this will not work, such as:
Response.Write("
");
Response.Redirect("main.html");
At this time, our prompt content will jump before it comes out, and Response.Redirect( "main.html"); makes no difference.
At this time we use the following code to test:
Response.Write("
");
Response.Write("
");
This achieves our requirements. After the prompt, the page will jump.
The most important thing is that the window.location.href statement can realize that the page of one frame refreshes the page of another frame after executing the server-side code (Response.Redirect cannot reach it, at least I have not found it):
For example: There are two frames in the index.htm page, namely frameLeft and frameRight. After executing the server-side code in the frameRight page, refresh the page in frameLeft.
The most common thing before was to automatically refresh the login box after registration, so that the login box is replaced by the logged-in page. As long as you add a paragraph after the successful registration code, you can refresh the page of another frame. The code is as follows:
<script>alert('恭喜您,注册成功!');</script>Response.Write("<script>alert('恭喜您,注册成功!')</script>"); <script>window.location.href='main.html'</script>Response.Write("<script>alert('恭喜您,注册成功!')</script>"); <script>window.parent.frameLeft.location.href='main.html'</script>