Forums

This topic is locked

onClick button to go to URL

Posted 11 Apr 2006 00:05:39
1
has voted
11 Apr 2006 00:05:39 Barrie Brown posted:
I am attempting to use onClick in a Form button to return to a previous URL.
The previous URL is "grabbed" using:
Session ("PageURL"=Request.ServerVariables("SCRIPT_NAME"+"?"+ Request.QueryString;

and then on the form:
<input type="button" value="PLEASE CONTINUE SHOPPING" onclick= "location.href='<%=Session("PageURL"%>'">

but it does not work - I think the syntax may be wrong?

Help please

Replies

Replied 19 Apr 2006 00:09:48
19 Apr 2006 00:09:48 Sal SM replied:
Try this instead

<input type="button" value="PLEASE CONTINUE SHOPPING" onclick="document.location.href='<a href = "javascript:history.go(-1)">back</a>;"

Not too sure but work around that because for a link to go back you can use <a href = "javascript:history.go(-1)">back</a>
so i recon something similar.

Reply to this topic