Copy codeThe Code is as follows:
<Input type = button value = Refresh onclick = "window. location. reload ()">
<Input type = button value = forward onclick = "window. history. go (1)">
<Input type = button value = backward onclick = "window. history. go (-1)">
<Input type = button value = forward onclick = "window. history. forward ()">
<Input type = button value = backward onclick = "window. history. back () "> back + refresh <input type = button value = back onclick =" window. history. go (-1); window. location. reload () ">
In the C # Web program, for example, for the page button writing back to the previous page code
Copy codeThe Code is as follows:
This. RegisterClientScriptBlock ("E", "<script language = javascript> history. go (-2); </script> ");
Among them, history. go (-2) should be written as-2. Because the page has been refreshed once before the button event is triggered, it should be-2.
Copy codeThe Code is as follows:
Response. Write ("<script language = javascript> history. go (-2); </script> ");
It must also be written as "-2 ". It is different from writing scripts directly. History. back () is the previous page
Copy codeThe Code is as follows:
I = 1
History. go (I)
[Html]
Go to a specified page
If it is history. go (0), it is to refresh these two JS codes, which is equivalent to IE's forward and backward functions.
The specific use depends on when this is needed. For example, the user registration verification is background verification, and this can be used when the user does not meet the requirements, to ensure that the user does not input data repeatedly to the maximum extent.
For example, load a page:
[Code]
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 "refreshing ":
OFrame. location. reload ();
}
}
}
To open a jsp page, you must have refreshed it using a client script.
How to refresh the page with Javascript:
Copy codeThe Code is as follows:
1 history. go (0)
2 location. reload ()
3 location = location
4 location. assign (location)
5 document.exe cCommand ('refresh ')
6 window. navigate (location)
7 location. replace (location)
8 document. URL = location. href