Skip to main content

Check a value from Array in javascript?



I have a:







var pageURL = location.href; // stores the URL of the current page in the var pageURL







And I have :







var Page = Array ();

page [0] = "http://web1.com"

page [1] = "http://web2.com"

page [2] = "http://web3.com"







Now I want to make a function (called nextPage) to check which one of these pages in the array equals the PageURL. Also I need to have a button, so when I click it it will take me to the next page. What that mean I want to increment the page by 1.


Comments