Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Go Back

Status
Not open for further replies.

ivormills

Technical User
Sep 14, 2005
19
GB
Is there a way to add an action to a button etc to go back to the previous page instead of using the browser back button?

Many thanks
 
You'll need Javascript, I believe its something like:

Code:
<input type=button value="Go Back" OnClick="document.history.go(-1);">


There might be a mistake, so for a more detailed explanation, and probably a correction on my code, you might want to go to the Javascript forum here:

forum216



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Thanks for your reply, but I have not found a soulution to this. I am not familiar with javascript, but all I want to do is add a go back command to a graphic on my pages, I do not want a button. In my 'behaviours' box I have an option to select a graphic and 'call javascript'. Is there a command that I can just cut and paste that would do what I want?

Many Thanks
 
Is there a way to add an action to a button etc to go back to the previous page instead of using the browser back button?

Well first you said a Button, and now you don't want a button.

Anyway:

I'm not aware of any behavior that is part of Dreamweaver for this, but adding it manually is not difficult.
From Code View:
You'll need to make the Image a link and then add this to the location of the link:

Code:
<a href="javascript:history.back(-1)"><img src="path/to/image.jpg"></a>
This will make your image clickable, and make it go to the last page that was visited before arriving at the current one.



----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
My appologies about the button confusion, and also please forgive me for my lack of knowledge in the javascript and programming etc. I basically use Photoshop to create my web pages, slice them and save for web. I use Dreamweaver as a vehicle to display the website and therefore have a limited knowledge of its technical workings, but back to this issue.

I have selected the image I want to link the 'go back' to and have pasted your link into the inspector link box.
I substituted my image I am making the link from, I hope that is correct.

<a href="javascript:history.back(-1)"><img src="images/Autofeeds-Page_10.gif"></a>

Either way I get a screen with 'The page cannot be displayed' etc. I am obviously doing something wrong, any help would be much appreciated.
 
Works Perfectly!

Many thanks for your help, I appreciate it.

Ivor
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top