FORWARD & BACK BUTTONS

<form>
<input type="button" value="<< Back" onClick="history.back(-1)" />&nbsp;
</form>

 


<form>
<input type="button" value="Forward >>" onClick="history.go(1)" />&nbsp;
</form>

 


FORWARD & BACK LINKS

<a href="javascript:history.back(-1)"><< Back</a>
<< Back

Alternatively, if you wanted to go forward instead of backward in the history, you would write the code thus:

<a href="javascript:history.go(1)"> Go Forward >> </a>
Forward >>

The numbers in the parentheses are the number of pages to move (forward or back, respectively, in the above examples).  You can also move more than one page; for instance javascript.history.go(-3) would navigate three pages back in the history.  Note that if there is no page in the history to go to, the JavaScript does not error out; it simply does nothing.

Close