Click to See Complete Forum and Search --> : back button?
sweetnes
04-06-2004, 07:47 PM
I don’t know if this is a script question but ill ask it here anyway. I have a page that allows users to enter criteria then the database searches for it. The then have the option to view more details, anyway how do I create a back button that goes straight back? (I don’t want to call up the original page because it is black and asks the users for criteria)
Monica
PeOfEo
04-06-2004, 08:10 PM
straight back to where? The index or the last page?
sweetnes
04-06-2004, 08:12 PM
the last page
PeOfEo
04-06-2004, 08:20 PM
Oh, well try this
<% response.Write("<a href='" & request.ServerVariables("HTTP_REFERER") & "'>Back</a>") %>
not sure if it works with a redirect... but I am going to test it real fast. Nope apparently it will not work with a redirect. Seems to work with a server.transfer, but those do not change the url in the address bar and tend to piss me off. You could pass the last page the user was at into the session, just the last part of course, you would not need the full url.
sweetnes
04-06-2004, 08:34 PM
sorry i didnt say, its a plane html page that goes back to an asp page
PeOfEo
04-06-2004, 08:42 PM
oh.... Well I just gave you a server side script, its not going to run from an html page. If you must use an html page your only option is a java script that uses the browser's history. To by frank, I hate java script. I find it to be rarely useful except for minor aesthtics. But I ripped this from an IIS 404 page just for you
<a href="javascript:history.back(1)">Back</a>
javascript:history.back(1) will go back in the browser's history one time. It is only going to work for those with browsers that support js and have it turned on. Umm this forum is putting a space between java and script in that example. javascript is how it should read, but the forum security measures are separating it.
sweetnes
04-06-2004, 08:52 PM
Im touched that you looked up java for me…mmmm… well…are there any other ways coz that didn’t work and I don’t thing I can change the setting of this computer. (Admin only)
PeOfEo
04-06-2004, 08:56 PM
Originally posted by sweetnes
Im touched that you looked up java for me…mmmm… well…are there any other ways coz that didn’t work and I don’t thing I can change the setting of this computer. (Admin only)
<a href="javascript:history.back(1)">Back</a>
Is going to be the only way to do it if you do not do it server side. You could find a vbscript alternative but then it will be IE only. I do not believe applets can do it, but I could be wrong. But it would be a pain in the butt to use an applet for something like this. That java script does work, but note when I post that code there should be no space between the words java and script. The forum parses text and gets rid of potentially harmful entries and it considers that to be one of them. Here is an example of it working http://knights.europe.webmatrixhosting.net/back.html click the link on that page and you will be here again if you have js enabled (actually never mind, poaste the link into another window click enter then click it, this forum will open stuff in a new window, thus no browser back button either). Java is not the same thing as Java Script by the way. Java script is an internet scripting language while java is a powerful object oriented computer programming language. Java script was renamed to that because of the popularity and similar syntax of java.
sweetnes
04-06-2004, 09:02 PM
thank you for you help It was much appreciated
PeOfEo
04-06-2004, 09:03 PM
no problem