So on my page I am using Iframe to display another webpage inside it. I want to set up an Array with many webpage (as much as I want) and I want to make 2 buttons so every time I click the Next button it will change the page inside the iframe tag that I have. My question is how can I setup the 2 buttons (Next and previous) so when I click them I will change accordingly to Array set up ?
<html xmlns="w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
var webpageArray = new Array()
webpageArray[0]= "web0.com/";
webpageArray[1]= "web1.com/";
webpageArray[2]= "web2.com/";
<iframe id="myframe" src="web1.com"></iframe>
loadNextPage = function() {
var iframe = document.getElementById("myframe");
var src = webpageArray[1];
iframe.src = src;
return;
}
<body>
<a href="" onclick="LoadNextPage"> Next Web Page >> </a>
</body>
</html>
See Question&Answers more detail:os