Introduction:
In
this article I will explain the jQuery code for go back to previous page i.e.
last visited page with back button option.
We need to write following code to implement this:
script type="text/javascript">
$(function
() {
$('#back').click(function () {
parent.history.back();
return
false;
});
});
</script>
Full source code for Sample Webpage:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Go Back to Previous Page</title>
<script type="text/javascript"
src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(function
() {
$('#back').click(function () {
parent.history.back();
return
false;
});
});
</script>
</head>
<body>
<fieldset style="width:300px">
<legend><strong>Go Back
to Previous Page</strong></legend>
<div>
<input type="submit"
name="go"
id="back"
value="Back to
Previous Page"/>
</div>
</fieldset>
</body>
</html>
0 comments:
Post a Comment