Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7044061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:21:53+00:00 2026-05-28T02:21:53+00:00

So on my page I am using Iframe to display another webpage inside it.

  • 0

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>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:21:53+00:00Added an answer on May 28, 2026 at 2:21 am

    This works – using PLAIN javascript and yes, an inline handler – it should be attached in onload, but let’s take it one thing at a time

    DEMO HERE

    <html>
      <head> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
        <title>Untitled Document</title> 
        <script>
          var cnt=0,webpageArray = [
            "http://cnn.com/",
            "http://msn.com/", 
            "http://yahoo.com/"
          ]; 
    
          function loadNextPage(dir) {   
            cnt+=dir;
            if (cnt<0) cnt=webpageArray.length-1; // wrap
            else if (cnt>= webpageArray.length) cnt=0; // wrap
            var iframe = document.getElementById("myframe"); 
            iframe.src = webpageArray[cnt]; 
            return false; // mandatory!
          } 
        </script>
      </head> 
    
      <body>  
      <iframe id="myframe" src="http://cnn.com/"></iframe> 
    
      <a href="#" onclick="return loadNextPage(-1)"> << Previus Web Page </a> | 
      <a href="#" onclick="return loadNextPage(1)"> Next Web Page >> </a> 
      </body> 
      </html>
    

    jQuery version

    DEMO HERE

    var cnt=0,webpageArray = [
      "http://cnn.com/",
      "http://msn.com/", 
      "http://yahoo.com/"
    ]; 
    
    $(document).ready(function() {
      $("#prev, #next").click(function(e) {
        cnt+=this.id=="next"?1:-1;
        if (cnt<0) cnt=webpageArray.length-1; // wrap
        else if (cnt>= webpageArray.length) cnt=0; // wrap
        $("#myframe").attr("src", webpageArray[cnt]);
        return false;
      });
    });    
    
    <iframe id="myframe" src="http://cnn.com"></iframe> <br />
    <a href="#" id="prev"> << Previous Web Page </a> | 
    <a href="#" id="next"> Next Web Page >> </a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Colorbox, and I want to load a specific div from another page
I need to display a page inside of a page, like an iframe, but
I'm using an iframe to display a website next to a form. I want
On the webpage I have iframe, in which I display some content. I want
I'm using an iframe in my page to display an embedded video. The issue
I am currently using an Iframe to display a source from another domain on
I am using fancy box iframe to display my page which has the file
Goal: I want to scrape the word Paris inside an iframe using cURL. Say
how to display the html page in flexpopup without using iframe any idea? Thanks,
I get a page using file_get_contents from a remote server, but I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.