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

_ how to use window.location.href

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

Share

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

This article mainly introduces how to use _ window.location.href, the introduction in the article is very detailed, has a certain reference value, interested friends must read!

Both _ window.location.href=_window.location.href; and _ window.location.Reload () and refresh the current page. The difference is whether the data is submitted. When data is submitted, _ window.location.Reload () prompts whether or not to submit, and _ window.location.href=_window.location.href; submits the data to the specified url.

Usage of _ window.location.href

There are many uses of location.href in javascript, mainly as follows.

Self.location.href= "/ url" the current page opens the URL page

Location.href= "/ url" the current page opens the URL page

The current page of windows.location.href= "/ url" opens the URL page with the same usage as the first three.

This.location.href= "/ url" the current page opens the URL page

Parent.location.href= "/ url" opens a new page on the parent page

Top.location.href= "/ url" opens a new page on the top-level page

If you customize the frame on the page, you can change the parentselftop to the name of the custom frame. The effect is to open the url address in the frame window.

_ window.location.href code

Response.Write ("alert ('Congratulations, successful registration!')

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

The copy code is as follows:

Response.Write ("alert ('Congratulations, successful registration!')")

Response.Write ("_ window.location.href='main.html'")

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 above is all the contents of the article "how to use _ window.location.href". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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