INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Event Handling

Making a <INPUT type=button> behave like the browser BACK button by jpbrassard
Posted: 15 Jul 03

This is one of the simpler things to do in JavaScript, but it's a good way of demonstrating how you can use the onclick event in various form elements to increase the functionality of your web page or application.

There are two ways to force the browser to go back to the previous page visited. These are detailed below.

history.go
<input type=button name=backButton id=backButton value="Back" onclick="javascript:history.go(-1)">

history.back
<input type=button name=backButton id=backButton value="Back" onclick="javascript:history.back">

Either one of those will act the same as the user clicking the back button on the browser. history.go is a little more powerful, because you can jump back more than one entry in JavaScript's history collection, but for most simple web pages, history.back will work just fine.

More info can be found at http://devedge.netscape.com/library/manuals/2000/javascript/1.3/reference/history.html. DevEdge is a pretty good general resource for JavaScript stuff.

HTH,
jp

Back to Javascript FAQ Index
Back to Javascript Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close