Home > Web Front-end > JS Tutorial > body text

Use window.location.href to refresh another frame page_Hacker Nature

WBOY
Release: 2016-05-16 19:17:52
Original
1003 people have browsed it

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>

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!