Back button

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I make a back button that returns to the previous page? I need it to
go to whatever last page the viewer was on, not a specific page.
 
In HTML view, add the following: <a
href="JavaScript:history.back()">Back</a>
 
I've tried the javascript code, it works in both IE and Navigator, but it
doesn't give a button, just "Back" underlined
I've tried a VBScript button, but this wont work with Navigator
 
Try this:

<input type="button" value="Back" Onclick="JavaScript:history.back()">

--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed............
........................with a computer
 
This would require a form tag, however -

<form action="..." method="..." name="easton">
<input type="button" value="Back" Onclick="JavaScript:history.back()">
</form>

and the <button> tag does not.

On the other hand, the former would be supported in v4+ browsers and the
latter only in v5+ ones.
 
To carry this a little further, is there any way to make this code work the
same as the browser back button, i.e. return to the previous page at the same
location that a person came from and not at the top of the previous page.

thanks
Bill
 
The code does exactly that, provided there is no script in the
previous page (such as an onfocus event) that would change the
behaviour.
 
I use this

<input type="button" value="Back" onclick = "history.back()">

The button is a bit prettier, althouhg this is a matter of taste :-) and the
code is a little more succinct

Experts, please correct me if this has any problems.
 
Back
Top