Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Usage of ASP.NET frame Page Jump _ window.location.href

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

The usage of ASP.NET frame page jump _ window.location.href, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.

When writing ASP.Net programs, we often encounter the problem of redirecting pages. We often use Response.Redirect to jump to ASP.NET frame pages. If customers want to use prompts when redirecting, this will not work, such as:

Response.Write ("

< script>

Alert ('Congratulations, registration is successful!')

< /script>

"); Response.Redirect (" main.html ")

At this point, our prompt jumps without coming out, which is no different from Response.Redirect ("main.html");.

At this point, let's try it with the following code:

Another implementation of ASP.NET frame Page Jump

Response.Write ("

< script language=javascript>

Alert ('Congratulations, registration is successful!')

< /script>

); Response.Write ("

< script language=javascript>

_ window.location.href='main.html'

< /script>

")

This is to achieve our requirements, after the prompt, jump to the page.

The most important thing is that the _ window.location.href statement enables the page of one frame to refresh the page of another framework after executing the server-side code (Response.Redirect can't be reached, at least I haven't found it):

For example, there are two frames in the index.htm page, frameLeft and frameRight, which refresh the page in frameLeft after executing the server-side code in the frameRight page.

Previously, the most common thing is that after registration, the login box is automatically refreshed to change the login box to the login 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:

Response.Write ("

< script language=javascript>

Alert ('Congratulations, registration is successful!')

< /script>

); Response.Write ("

< script language=javascript>

Window.parent.frameLeft.location.href='main.html'

< /script>

")

This solves the problem of ASP.NET frame page jump interruption.

This is the answer to the question about the usage of ASP.NET frame page jump _ window.location.href. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report