View Single Post
Old 10-04-2012, 01:53 AM   PM User | #8
markman641
Regular Coder

 
Join Date: Jul 2011
Posts: 246
Thanks: 58
Thanked 1 Time in 1 Post
markman641 has a little shameless behaviour in the past
Thanks! If anyone is wondering, I changed it up just a bit so that after the last page, it submits the form.

Code:
<html>
  <head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>Untitled Document</title> 
  </head> 
<body>  

<iframe id="myframe"></iframe> 

<form name="this_form" method="POST" action="">
    <input type="submit" name="submit3" value="Submit" onclick="loadNextPage(1)">
</form>
<script type="text/javascript">
      var cnt=0,webpageArray = [
        "http://cnn.com/",
        "http://rapidcashgpt.com/", 
        "http://codingforums.com"
      ]; 

      function loadNextPage(dir) {   
        cnt += dir;
        // this can never happen: if (cnt<0) cnt=webpageArray.length-1; // wrap
        
        if (cnt>= webpageArray.length) {
            return;
        } 
        var iframe = document.getElementById("myframe"); 
        iframe.src = webpageArray[cnt]; 
        document.this_form.submit3.disabled = true;     
        setTimeout( function() { document.this_form.submit3.disabled = false; }, 10000 );
      } 
      loadNextPage(0); // actually loads first page
</script>
</body>
</html>
markman641 is offline   Reply With Quote