Methods or Function: forward()
forward() function is used in javscript to
go to the next page in the history list.
This does the same function as of next button in the browser window.
Code: history.back();
Example: To create a button that takes to the next page
when users click on it using javascript.
Result:
To test this go to next web page, come back and do the testing
In the above example
a) we created a button
b) added an onClick event listener to the button.
c) when user clicks on the button the javascript function gonext()
will be invoked.
d) in the gonext() function we call history.forward().
Javascript (JS) is one of the most used languages in the world. Some times spelled as Java Script.
Hope you enjoy this tutorial. Do send your feedback or suggestions on this javascript or java script tutorial. This is a copyright content.