Announcement

Collapse
No announcement yet.

A script like this

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • A script like this

    I am trying to create this page where I have a single Iframe and I want to add a button to show a next page in the iframe.

    I have a total of 4 or more pages to show in the iframe named 1.html 2.html 3.html 4.html 5.html and I would like the buttons to work going from 1 to 5 and so on.

    the sketch is something like this:

    _________
    | IFRAME |

    ___________


    <<previous Next >>

    What i have so far is like the one bellow:

    Code:
    <html>
      <head>
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script>
          var locations = ["1.html", "2.html", "3.html","4.html" "5.html"];
          var currentIndex = 0;
          var len = locations.length;
          $(document).ready(function(){
            $(':button').click(function() {
                currentIndex = this.value == "Next" ? 
                    currentIndex < len - 1 ? ++currentIndex : 0 : 
                    currentIndex > 0 ? --currentIndex : len - 1;
    
                $('#frame').attr('src', locations[currentIndex]);
            });
          });
        </script>
      </head>
      <body>
        <input type = "button" value = "Previous" />&nbsp;<input type = "button" value = "Next" />
        <br />
        <iframe id="frame" src="1.html"></iframe>
      </body>
    </html>
    and under var locations i want to show the page with time interval

    like: 1.html show every 5 minutes and 2.html show evert 10 minutes and 3.html show every 15 minutes and 4.html shows every 20 minutes.

    how do i do that?
Working...
X