Saturday, July 11, 2009

Javascript : Creating Back button

Back buttons are used to return to the previous page. This is the same as using the back button on your browser.

You can use below codes in HTML/JSP etc pages.

Creating Back Button

<FORM><INPUT TYPE="button" VALUE="Back" onClick="history.go(-1);return true;"> </FORM>

The javascript:history.go(-1) code displays the previous page.Change the value of -1 to any number of pages you would like to send your visitors back

Instead of Button you can also used it for any link or image.

An image used as back button.

<A HREF="javascript:history.go(-1)">
<IMG SRC="images/back.gif"
BORDER="0"></A>


A standard link as back button.

<A HREF="javascript:history.go(-1)"> [Go Back]</A>



No comments:

Post a Comment