Jump to content

Clean Up/Speed up help


Bertjuhh66

Recommended Posts

First of all the code:

 

<script type="text/javascript">
      var reload = false;

      function countDown()
      {
        countDownTime--;
        if ( document.getElementById( "countDownText" ) )
        {
          document.getElementById( "countDownText" ).innerHTML = secsToMins( countDownTime );
        }
        if ( countDownTime == 0 )
        {
          clearInterval( countdown_timer );
          document.location.reload();
          return;
        }
        else if ( countDownTime < 0 )
        {
          countDownTime = 10;
        }
      }
      function secsToMins( theValue )
      {
        if( theValue <= 0 )
        {
          return( "reloading..." );
        }
        var theMin = Math.floor( theValue / 60 );
        var theSec = ( theValue % 60 );
        if ( theSec < 10 )
        {
          theSec = "0" + theSec;
        }
        return( theMin + ":" + theSec );
      }
      var countDownTime = <?php _e( $secs_remain ); ?>;
      countdown_timer = setInterval ( "countDown();", 1000 );
    </script>

 

This works, but the document.location.reload is a bit slow...Is there a way too speed things up?

Link to comment
https://forums.phpfreaks.com/topic/264107-clean-upspeed-up-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.