View Single Post
Old 10-29-2012, 03:00 AM   PM User | #16
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
Quote:
Originally Posted by Old Pedant View Post
Which code isn't working in FF? Exactly what is in your post #11 or something different?
I'll get you the code. Firefox is reloading the page. You can see it here: http://www.QuizBonanza.com/campaigns/iframe.php


Code:
<iframe id="myframe" width=100% height=1000px></iframe> 

<form name="this_form" method="POST" action="">
    <input type="submit" name="submit4" value="Submit" onclick="loadNextPage(1)"></button>
</form>
<?
$link = mysql_connect('localhost', 'ad20_ad20', 'xxxxxxxx');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db('xxxxxxx', $link);
if (!$db_selected) {
    die ('Can\'t use foo : ' . mysql_error());
}
?>
<script type="text/javascript">
      var cnt=0,webpageArray = [<?php
$query = "SELECT URL FROM path where campaigns LIKE '%$currentFile%'";
$result = mysql_query($query) or die( mysql_error() );
$delimiter = "";
while ( $row = mysql_fetch_array($result) )
{
    echo $delimiter . '"' . $row[0]. 'UNIQUEID' . '"' ;
    $delimiter = ",\n";
}
?>]; 
      var countDown;

      function doCountDown( )
      {
          var btn = document.this_form.submit4;
          if ( countDown <= 0 )
          {
              btn.value = "Submit";
              btn.disabled = false;
              return;
         }
         btn.value = "Submit... " + countDown;
         btn.disabled = true;
         --countDown; 
         setTimeout( doCountDown, 1000 );
    }

    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]; 
        countDown = 10;
        doCountDown( );
$('html, body').animate({ scrollTop: 0 }, 'fast');
    } 
    loadNextPage(0); // actually loads first page
</script>

Last edited by markman641; 10-29-2012 at 03:15 AM..
markman641 is offline   Reply With Quote