Back to Index
JavaScript Examples
Changing Background Colours
Let The Banners Fly!
Days Till The Millenium
Mortgage Calculator
Carbon Dating Calculator
Online Quiz
A Simple MouseOver (Rollover) Script
Popup Windows
Protected Password
Back Button
JavaScript allows you to make use of the history information in a browser so you can send someone back to the page they came from before they reached your page.
Try this button. It will take you back to the pages you visited before you got here! (unless you came here first of course)
<form> <INPUT TYPE="button" VALUE="go back!" onclick="history.back()"> </form>
Another way of doing the same thing is to use onclick="history.go()" and this can move you back (or forwards) more that 1 page of the URL's you have visited. Try the button below to go back 2 pages.
<form> <INPUT TYPE="button" VALUE="go back!" onclick="history.go(-2)"> </form>
The back button is particularly useful when your visitor reaches a page that is generated by a data base and may not contain any navigational links.