How to move to a certain page in history list using javascript
Explanation
Methods or Function: go()
go() function takes one argument. It can take an integer argument or a string argument. Code: go(n); where n can be a negative, zero or positive integer. a) if n<0, it takes to the previous pages in the history list. i.e go(-1) takes to previous page, go(-2) takes two page back and so on.. b) if n=0, nothing happens c) if n>0, it takes to the next pages in the history list. i.e go(1) takes to next back, go(2) takes two pages ahead and so on..
Example:
To create a button that loads two pages backward using javascript.
In the above example a) we created a button b) added a onClick event listener to the button. c) when user clicks on the button the javascript function gourl() will be invoked. d) in the function we call history.go(-2) to go two steps backward.