SQL PHP HTML ASP JavaScript articles and free scripts to download
HTML Buttons

HTML and JavaScript code for back button in to go previous pages

We can show a back button using html code in our pages which can take the browser window to the previous page. This page will have a button or a link and by clicking it browser will return to previous page. This can be done by using html or by using JavaScript in the client side.

Code for HTML back button can be placed any where inside the page ( or inside body tag ). This button will work in same as the back button at the tool bar of our browser. Here also we can set to go previous one or more than one step of pages. Here is our button and simple code for back button of our browser.

Demo of returning to previous page by using back button

Here is the code of this button

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

You can read more on history object of JavaScript here This code will display one button and you can change the value parameter to display any text on the button. Here is the button to take you back to previous page. Note that the onClick event can be set to history.go(-3); to move back three steps. We can use +2 also to move forward two steps.

Using JavaScript

We can use JavaScript to create a link to take us back to previous or history page. Here is the code to move back the browser using client side JavaScript.

<a href = "javascript:history.back()">Back to previous page</a>

As you can see this requires JavaScript to be enabled in the client browser. Otherwise this code will not work.

Using buttons to link different pages

Number of User Comments : 11


Google+
Donna Calcavecchio26-01-2012
I want the user to go back to the same spot the click on link appears after he closes a linked page
mohammed09-04-2012
thank you thank you again you saved me from searching for fays you are the best
Frank27-07-2012
Excellent! Exactly what I was looking for. Thanks
SHAMEEL KT06-01-2013
Excellent....
narendra30-01-2013
nice dear...thanks
mary02-04-2013
Thanks! Just what I needed
Rahul16-04-2013
thank u sir
hanumantha30-07-2013
Nice one
Richard19-01-2014
Is there a way to utilize a back button to manipulate an iframe?
Abdul_Karim23-09-2014
Thanks Exactly the thing what I was looking for
Ashish06-11-2014
i want page will be load on back button click..
Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked



HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us

©2000-2014 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer