js return to the previous page implementation method

In the past, when submitting a form, if there was an error and the information was gone when I returned, I didn't know how to save it, so I started the stupidest way to set the filled data into the session, and then take it out and use it. , but I didn't try it successfully, there are always mistakes. I accidentally saw the method of javascript:history.go(-1); in my js information book, huh, I tried it once, and it really realized the data Keep a summary. If you have time, do some research.

Here is the commonly used code:

<a href="<a href="javascript :history.back(-1)">Back to previous page</a>
or
<a href="javascript :;" onClick="javascript :history.back(-1 );">Back to previous page</a>

If it is done with a button:
<input type="button" name="Submit" onclick="javascript:history.back(-1);" value="back to the previous page">

If you do it with an image:
<a href="javascript :;" onClick="javascript :history.back(-1);"><img src="image path" border="0" title="Return to the previous page "></a>


[color=#FF0000]After a few seconds[/color] will automatically return to the previous page of code: (add two heads, 3000 means 3 seconds)
<SCRIPT language=javascript>
function go()
{
window.history.go( -1);
}
setTimeout("go()",3000);
</SCRIPT>

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326965069&siteId=291194637