To be short, today I will introduce a method to implement this function. Friends who need to know can refer to it:
1. JS reload page, refresh locally, return to the previous page
The code is as follows:
<a href="javascript:history.go(-1)">Return to the previous page</a> <a href="javascript:location.reload()">Reload the page, local refresh</a> <a href="javascript:history.go(-1);location.reload()">Return to the previous page, local refresh</a>
How should I write the JS code that returns to the first two pages and refreshes.
The code is as follows:
history.go(-2);
location.reload();
2. js method
The code is as follows:
<a href="#" onclick="self.location=document.referrer;">Return</a>
How to automatically return and refresh asp:
The code is as follows:
response.Write("<script language=javascript>self.location=document.referrer;</script>")
It is generally used to submit an action to a page and return to the previous page and refresh it!
1.Javascript returns to the previous page history.go(-1), and returns two pages: history.go(-2);
2.history.back().
3.window.history.forward() returns to the next page
4.window.history.go (return to the page, you can also use the visited URL)
example:
<a href="javascript:history.go(-1);">Previous page</a>response.Write("<script language=javascript>")response.Write("if(!confirm('Complete the task?')){history.back();}")response.Write("</script>")response.Write("<script language=javascript>history.go(-1);</script>")<a href="javascript:history.go(-1);">Previous page</a>response.Write("<script language=javascript>history.go(-1);">Previous page</a>response.Write("<script language=javascript>history.go(-1);">Previous page</a>response.Write("<script language=javascript>history.go(-1);">Previous page</a>response.Write("<script language=javascript>history.go(-1);">Previous page</a>response.Write("<script language=javascript>history.go(-1);">Previous page</a>response.Write("<script language=javascript>history.go(-1);">Previous page</a>response.Write("<script language=javascript>history.go(-1);">Previous page</a>response.Write("<script language=javascript>history.go(-1);">Previous page</a>response.Write("<script language=javascript>history.go(-1);">Previous page</a>response.Write("<script language=PS
Tips (JS quotes 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>Several ways to refresh a page in Javascript:
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 automatically refresh the page:
1. Automatic page refresh: add the following code to the area
<meta http-equiv="refresh" content="20">
20 of which refer to refreshing the page every 20 seconds.
2. Automatic page jump: add the following code to the <head> area
<meta http-equiv="refresh" content="20;url=http://chenhaoxiang.github.io">
Among them, 20 fingers jump to the http://chenhaoxiang.github.io page after 20 seconds.
3. Automatic page refresh
<script language="JavaScript">function myrefresh(){ window.location.reload();}setTimeout('myrefresh()',1000); //Specify refresh once in 1 second</script>How to output a refresh parent window script statement
1. this.response.write("<script>opener.location.reload();</script>");
2. this.response.write("<script>opener.window.location.href = opener.window.location.href;</script>");
3. Response.Write("<script language=javascript>opener.window.navigate(''The page you want to refresh.asp'');</script>")
JS refresh framework script statement
//How to refresh the page containing the framework with <script language=JavaScript> parent.location.reload();</script>//Sub window refresh the parent window <script language=JavaScript> self.opener.location.reload();</script>(or <a href="javascript:opener.location.reload()">reload()">reload())//How to refresh the page containing the framework with <script language=JavaScript> parent. Another FrameID.location.reload();</script>
If you want to refresh when the window is closed or refresh when the window is opened, just call the following statement.
<body onload="opener.location.reload()"> Refresh when the window is opened<body onUnload="opener.location.reload()"> Refresh when the window is closed<script language="javascript">window.opener.document.location.reload()</script>
3. Use JS to return to the previous page and refresh in ASP
I think it is often used when using ASP to develop websites using ASP. But there are several ways to write, but the purpose is the same.
The code is as follows:
<% response.write("<font color=""red"" font-size=""12px""> has been deleted successfully!font>") %> <div align="center">[<a href="/"onClick="javascript :window.history.go(-1);return false;" class=fontsize14><span style="color: #CC0033">Return</span></a>]</div>The function implemented by this code is to inform the user that the function implemented has been achieved, but when returning, it is best to refresh the original page so that the new information is displayed or that the deleted things are not displayed. However, this code cannot refresh the original web page when it returns.
So you need to add a piece of code to the original page:
<script> if(window.name != "Bencalie"){ //If the name attribute of the page is not the specified name, refresh it location.reload(); window.name = "Bencalie"; } else{ //If the name attribute of the page is the specified name, do nothing to avoid continuous refreshing of window.name = ""; } </script>This will achieve our goal and return to the previous page and refresh.
Of course there is a simpler code than this.
response.write("<script>alert('Delete successfully!');window.location='Original page';</script>");
The above is all the content of this article. I hope it will be helpful to everyone's learning and I hope everyone will support Wulin.com more.