Practical PC
Stripe

Reviews
Web Building Guides
Computing Guides
Opinion
Downloads
About Practical PC


 

 
Sections
Getting Started
For the absolute novice.
 
Web Building software
The tools of the trade.
 
Design Tips
How to make your Web site look great
 
Web Building scripts
Things that make your Web site dazzle.

Web Bulding Guides
 PPC> Web building> Scripts  

Simple Back Button

One of the most under-rated navigational tools is very simple to implement - if you know how!

You will doubtless have been to many Web sites that supply you with a means to hop back a page, to the one you've just come from - the "Back" button or link. It's a very useful adjunct to the normal buttons found on the menu and toolbars of most browsers, in that you can include the "Back" link anywhere you like on your page, so it's always handy.

It works by reading the user's History trail, and simply re-loading the last page visited. We've provided two versions:

Text link:

<a href="#" onClick="history.go(-1)">Back</a> 

Button:

<input type=button value="Back" onClick="history.go(-1)">

You'll see that in both versions you have "history.go(-1)" which is a fairly obvious pointer to how it works. You can, of course, change the "(-1)" to "(-2)" or any other number that takes your fancy, although I can't think of a reason why you'd want to just at the moment!

Anyway, the example and code are here - enjoy!


 

ppc


 
counter