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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a back button... 2

Status
Not open for further replies.

blondends

Technical User
Apr 25, 2003
84
GB
Hi,

I have a two web pages - the first with a drop down that selects the date range for a query on a database and reloads the same page showing the results, and the second page which is a detail page for each of the results. Well what i want to do is have a back button that will go from the detail page to the results on the first page without the user having to requery the page to see the results. In short i need a back button that will go back in the same way the browser button does.

Any ideas ?

Chris
 
You can try using javascript: history.back() or history.go(-1) ... something like that.
Not sure about vbscript.
 
blondends,

As hecktic stated, Javascript would be the easiest way to do it. You can use the following:

<input type=&quot;button&quot; name=&quot;Back&quot; value=&quot;Back&quot; onClick=&quot;window.history.back();&quot;>

Mark.
 
Thanks both of you for your replies.

Can i ask one question about using Javascript with vbscript on the same webpage. Is it possible and how would you go about it?

Thanks again,

Chris
 
Yes you can, just use <script language=&quot;javascript&quot;>
and <script language=&quot;vbscript&quot;>, vars will be accessiblwe by both scripting laguages.
 
Cool, thanks for your help!!! That has solved one of the many things that i am still working at. Just that one problem had me stumped - tying to pass variables back and forth between the pages and then got my self in a mess.

Cheers

Chris
 
Its likely you are using VBscript as your server-side language with ASP, and JavaScript as your client-side language for stuff like simulating the back button.

If so, they don't/can't interact :)

Posting code? Wrap it with code tags: [ignore]
Code:
[/ignore][code]CodeHere
[ignore][/code][/ignore].
 
Variables can interact between ASP and Javascript.

Let's say you wanted to create a client side variable in Javascript with a value from ASP(VBScript). This would work:

<script language=&quot;javascript&quot;>
var strValue = &quot;<%=strVBValue%>&quot;;
</script>

In the above example, the ASP variable &quot;strVBValue&quot; would actually pass to the Javascript variable &quot;strValue&quot;.

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top