05-28-2006, 03:46 PM
<input type=submit value="Back to previous page" class=header onClick="history.go(-1)">
for some reason it is submitting the form instead of going back a page --
why would this be?
05-28-2006, 04:11 PM
onClick="history.go(-1); return false;"
Perhaps you should consider not using a submit button in the first place.
<input type="button" … onClick="history.go(-1); return false;">
Bear in mind that this isn't going to work if the user doesn't have js enabled/available.
Ideally, you'd make the presence of this button dependant on js, either by using js to inset it into the page or by only having this button appear beyond some js-only threshold.
Alternatively, you could consider using PHP to dynamically code the url into a proper link based on the referrer.
<p><?php if (isset($_SERVER['HTTP_REFERER'])) echo '<a href="'.$_SERVER['HTTP_REFERER'].'">Back</a>'; ?></p>
05-28-2006, 04:32 PM
try to use: history.back()
05-28-2006, 11:57 PM