This is a creation in Article, where the information may have evolved or changed.
Transferred from: http://www.mikebai.com/Article/2009-11/757.html
<input Type=button value= Refresh onclick= "Window.location.reload ()" >
<input Type=button value= forward onclick= "Window.history.go (1)" >
<input Type=button value= back onclick= "Window.history.go ( -1)" >
<input Type=button value= forward onclick= "Window.history.forward ()" >
<input Type=button value= back onclick= "Window.history.back ()" > Back + refresh <input Type=button value= back onclick= " Window.history.go ( -1); Window.location.reload () "> in C # Web programs, such as Page button write back to the previous page of code
This. RegisterClientScriptBlock ("E", "<script language=javascript>history.go ( -2);</script>");
Wherein, HISTORY.GO (-2), to write as-2, because the button event triggered before the page has been refreshed once, so should be-2.
Response.Write ("<script language=javascript>history.go ( -2);</script>");
It is also written here as "-2". It's different from direct script writing. History.back () is a previous page
I=1
History.go (i) go to the specified page
If it is history.go (0) that is to refresh these two belong to the JS code, the equivalent of IE forward, backward function.
The specific use depends on when you need this. For example, the user registration verification is the background verification, do not meet the requirements of the time you can use this, can maximize the user to ensure less repetitive input data.
For example: Loading page:
function Onloadpage () {
if (event.srcelement.tagname== "SPAN") {
OFRAME=TOP.WINDOW.MIDDLE.FRAMES[2];
Otxt=event.srcelement.innertext;
Switch (otxt) {
Case "forward":
OFrame.history.go (1);
Case "Back":
OFrame.history.back ();
Case "Refresh":
OFrame.location.reload ();
}
}
}
Opens a JSP page, which must have been refreshed with client 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