Js returns to the previous page and refreshes the various implementation methods

  • 2020-03-30 02:09:20
  • OfStack

< A href = "javascript: history. The go (1)" > Return to previous page < / a>
< A href = "javascript: location. Reload ()" > Refresh the current page. / a>
< A href = "javascript:" onclick = "history. Go (2); "> Back to first two pages < / a>
< A href = "javascript:" onclick = "self. The location = document. The referrer;" > Go back to the previous page and refresh. / a>
< A href = "javascript:" onclick = "history. The back (); "> Return to previous page < / a>

Page jump:

The onclick = "window. The location. Href = 'list. PHP'"

Several ways Javascript can refresh a page:

1, the history. The go (0)
2, the location. Reload ()
3, the location = location
4, the location. The assign (location)
5, document. ExecCommand (" Refresh ")
6, window. 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 = "10" >

10 means refresh the page every 10 seconds.

2. Automatic page redirect: add the following code < Head> In the area

< Meta HTTP - equiv = "refresh" content = "10; url=http://www.baidu.com ">

10 fingers after 10 seconds to jump to http://www.baidu.com page

Js automatically refreshes the current page:
 
<script language="JavaScript"> 
function myrefresh() 
{ 
window.location.reload(); 
} 
setTimeout('myrefresh()',1000); //Specifies a refresh every 1 second
</script> 

JS refreshes the script statement of the framework
 
//Refresh the pages containing the framework
<script language=JavaScript> 
parent.location.reload(); 
</script> 

//The child window refreshes the parent window
<script language=JavaScript> 
self.opener.location.reload(); 
</script> 
( or <a href="javascript:opener.location.reload()"> The refresh </a> ) 

//How to refresh the page of another frame
<script language=JavaScript> 
parent. another FrameID.location.reload(); 
</script> 

Refresh to close a window or refresh to open a window, in < Body> The following statement can be called:
 
<body onload="opener.location.reload()">  Refresh when opening a window  
<body onUnload="opener.location.reload()">  Refresh when closed  
<script language="javascript"> 
window.opener.document.location.reload() 
</script> 

Related articles: