JS returns the code of the previous page and refresh

Time:2021-5-1

1. JavaScript returns to the previous page history. Go (- 1) and two pages: history. Go (- 2);
2. history.back().
3. Window. History. Forward() returns to the next page
4. Window.history.go
Example:
<a href=”j avascript:history.go (-1);”> Page up</a>
response.Write(“<script language=javascript>”)
response.Write(“if(! Confirm (‘finish task? ‘){ history.back();}”)
response.Write(“</script>”)
response.Write(“<script language=javascript>history.go(-1);</script>”)
<a href=”j avascript:history.go (-1);”> Page up</a>
Page Jump: onclick = “window. Location. A
P.S.
Tips (JS reference JS)
<script type=text/javascript>
<!–
if (typeof SWFObject == “undefined”) {
document.write(‘<scr’ + ‘ipt type=”text/javascript” src=”/scripts/swfobject-1.5.js“></scr’ + ‘ipt>’);}
//–>
</script>
There are several methods for JavaScript to refresh the page
1    history.go(0)
2    location.reload()
3    location=location
4    location.assign(location)
5    document.execCommand(‘Refresh‘)
6    window.navigate(location)
7    location.replace(location)
8    document.URL=location.href
How to refresh the page automatically:
1. Automatic page refresh: add the following code to the < head > area
<meta http-equiv=”refresh” content=”20″> 
Among them, 20 refers to refresh the page every 20 seconds
2. Page auto jump: add the following code to the < head > area
<meta http-equiv=”refresh” content=”20;url=http://www.javaeye.com”> 
Among them, 20 fingers jump tohttp://www.javaeye.compage
3. The page automatically refreshes JS version
<script language=”JavaScript”>
function myrefresh()
{
       window.location.reload();
}
setTimeout(‘myrefresh()’,1000); // Specify refresh every 1 second
</script>
How to output script statement of refreshing parent window in asp.net
1.   this.response.write(“<script>opener.location.reload();</script>”);
2.   this.response.write(“<script>opener.window.location.href = opener.window.location.href;</script>”);
three    Response. Write (“< script language = javascript > opener. Window. Navigate (”page you want to refresh. ASP ”)</ script>”)
JS refresh framework script statement
//How to refresh the page containing the frame
<script language=JavaScript>
   parent.location.reload();
</script>
//Child window refreshes the parent window
<script language=JavaScript>
    self.opener.location.reload();
</script>
(or < A avascript:opener.location.reload () “> refresh</a>    )
//How to refresh the page of another frame
<script language=JavaScript>
   Parent. Another frameid. Location. Reload();
</script>
If you want to refresh when you close the window or refresh when you want to open the window, you can call the following statements in <body>.
< body onload = “opener. Location. Reload()” > refresh when opening window
< body onunload = “opener. Location. Reload()” > refresh on close
<script language=”javascript”>
window.opener.document.location.reload()
</script>

Recommended Today

Large scale distributed storage system: Principle Analysis and architecture practice.pdf

Focus on “Java back end technology stack” Reply to “interview” for full interview information Distributed storage system, which stores data in multiple independent devices. Traditional network storage system uses centralized storage server to store all data. Storage server becomes the bottleneck of system performance and the focus of reliability and security, which can not meet […]