Here you can find a number of examples on Java Script.Please find the various kinds of examples listed on the right side of this site. If you don't find anything on Java Script then please write to us or leave a commnet. We are pleased to help and find the solution of your problem.

JavaScript: History list manipulation



History.Back Object
The History object contains an array of previously visited URLs by the visitor. To simulate the browser's back button, for example, you can use the History object:



The Previous URL in the History List
<html>
<head>
<title>Javascript - Browser history list manipulation</title>
</head>
<body>
<a href="javascript:history.back(-1)">Go Back one Page</a>
<a href="javascript:history.back(-2)">Go Back Two Page</a>
<a href="javascript:history.back(-3)">Go Back Three Page</a>
.
.
.
<a href="javascript:history.back(-n)">Go Back n Page</a>
</body>
</html>




History.Forward Object
The History object contains an array of Next visited URLs by the visitor. To simulate the browser's forward button, for example, you can use the History object:



The next URL in the History List
<html>
<head>
<title>Javascript - Browser history list manipulation</title>
</head>
<body>
<a href="javascript:history.forward(1)">Go Forward one Page</a>
<a href="javascript:history.forward(2)">Go Forward Two Page</a>
<a href="javascript:history.forward(3)">Go Forward Three Page</a>
.
.
.
<a href="javascript:history.forward(n)">Go Forward n Page</a>
</body>
</html>




History.go
Go to nearest URL in History List.
Go on this Page
<html>
<head>
<title>Javascript - Browser history list manipulation</title>
</head>
<body>
<a href="javascript:history.go(Link Address)">Link name</a>
</body>
</html>

No comments:

Post a Comment

Google