Several methods of refreshing the page summary of JS ASP.NET
- 2020-03-30 01:15:51
- OfStack
Several ways Javascript can refresh a page:
1. The history. The go (0)
2. The location. Reload ()
3. Location = location
4. The location. The assign (location)
5. Document. ExecCommand (" Refresh ")
6. Windows. Navigate (location)
7. The location. The replace (location)
8. The document. The URL = location. Href
Automatic page refresh method:
1. Automatic page refresh: add the following code < Head> In the area
< Meta HTTP - equiv = "refresh" content = "20" >
Where 20 refers to refreshing the page every 20 seconds.
2. Automatic page redirect: add the following code < Head> In the area
< Meta HTTP - equiv = "refresh" content = "20; url=http://jay-xu33.cnblogs.com/ > ""
20 refers to every 20 seconds after the jump to http://jay-xu33.cnblogs.com/ pages
3. Page automatically refreshes js version
< Script language = "JavaScript" >
The function myrefresh ()
{
Window. The location. Reload ();
}
SetTimeout (' myrefresh () ', 1000); // specifies a refresh of 1 second
< / script>
How does ASP.NET output the refresh parent window script statement
1. This. Response. Write (" < Script> Opener. Location. Reload (); < / script>" );
2. This. Response. Write (" < Script> Opener. Window. The location. The href = opener. Window. The location. The href; < / script>" );
3. Response. Write (" < Script language = javascript> Opener. Window. Navigate (' page you want to refresh. Asp '); < / script>" );
JS refreshes the script statement of the framework
// how to refresh the page containing the framework with
< Script language = JavaScript>
The parent. The location. Reload ();
< / script>
// child window refreshes parent window
< Script language = JavaScript>
Self. Opener. Location. Reload ();
< / script>
(or < A href = "javascript: opener. Location. Reload ()" > Refresh < / a> )
// how to refresh the page of another frame using
< Script language = JavaScript>
The parent. Another FrameID. Location. Reload ();
< / script>
If you want to refresh when you want to close the window or refresh when you want to open the window, in < Body> The following statement can be called.
< The body onload = "opener. Location. Reload ()" > Refresh when the window opens
< Body onunload = "opener. Location. Reload ()" > Refresh when closing the window
< Script language = "javascript" >
Window. Opener. The document. The location. Reload ()
< / script>