Returning to the previous page and refreshing the user-friendly experience in this feature is a must for every web developer, long story short, today describes a way to implement this feature that needs to be understood by a friend who can refer to the next
One: JS reload page, local refresh, return to previous page
Copy CodeThe code is as follows:
<a href= "Javascript:history.go ( -1)" > Back </a>
<a href= "Javascript:location.reload ()" > Reload page, local refresh </a>
<a href= "Javascript:history.go ( -1); Location.reload ()" > Back to previous Reload page, local refresh </a>
Return to the first two pages and refresh the JS code should be how to write.
Copy CodeThe code is as follows:
History.go (-2);
Location.reload ();
Two: Js method
Copy CodeThe code is as follows:
<a href= "#" onclick= "Self.location=document.referrer;" > Back </a>
How the ASP automatically returns and refreshes:
Copy CodeThe code is as follows:
Response. Write ("<script language=javascript>self.location=document.referrer;</script>")
Typically used to submit an action to a page and then return to the previous page and refresh!
1. Javascript returns to previous page History.go (-1), returns two pages: History.go (-2);
2. History.back ().
3. Window.history.forward () return to next page
4. Window.history.go (return to page or use the URL you have visited)
Cases:
<a href= "Javascript:history.go (-1);" > Up one page </a>
Response. Write ("<script language=javascript>")
Response. Write ("if (!confirm (' Complete task? ')") {History.back ();} ")
Response. Write ("</script>")
Response. Write ("<script language=javascript>history.go ( -1);</script>")
<a href= "Javascript:history.go (-1);" > Up one page </a>
Page Jump: onclick= "window.location.href= ' list.aspx '"
P.S.
Small tricks (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>
JavaScript refreshes the page in several ways:
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
Ways to automatically refresh pages:
1. Automatic page refresh: Add the following code to the <meta http-equiv= "Refresh" content= ">"
20 refers to a refresh of the page every 20 seconds.
2. Page Auto-jump: Add the following code to the <meta http-equiv= "Refresh" content= "20;url=http://www.javaeye.com" >
Where 20 means jump to http://www.javaeye.com page after 20 seconds
3. Page automatically refresh JS version
<script language= "JavaScript" >
function Myrefresh ()
{
Window.location.reload ();
}
SetTimeout (' Myrefresh () ', 1000); Specify 1 seconds to refresh
</script>
ASP. NET how output refreshes the 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 that contains the frame
<script language=javascript>
Parent.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 another frame's page with
<script language=javascript>
Parent. Another FrameID.location.reload ();
</script>
Call the following statement in <body> if you want to refresh the window or refresh it when you want to open it.
<body onload= "Opener.location.reload ()" > Windows Refresh
<body onunload= "Opener.location.reload ()" > Refresh when off
<script language= "JavaScript" >
Window.opener.document.location.reload ()
</script>
Third: The ASP in the use of JS implementation to return to the previous page and refresh
The use of JS implementation in ASP to return to the previous page and refresh I would like to use ASP to develop the site often used. But there are several ways to do it, but the purpose is the same.
Copy CodeThe 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 "> Back </span></a>]</div>
The function of this code is to tell the user that if the implemented function has been achieved, but it is best to refresh the original page when returning to show the new information or let the deletion of things are not displayed. However, this code does not refresh the original page when it is returned.
So you need to add such a piece of code to the original page:
<script>
if (window.name! = "Bencalie") {
If the page's Name property is not the specified name, refresh it
Location.reload ();
Window.name = "Bencalie";
}
else{
If the Name property of the page is specified, do nothing to avoid a constant refresh
Window.name = "";
}
</script>
This will do what we have to do--go back to the previous page and refresh.
Of course there is a simpler code than this, Response.Write "<script>alert (' Delete success! '); window.location= ' original page ';</script> '
JS go back to the previous page and refresh the code to defragment