Bertjuhh66 Posted June 13, 2012 Share Posted June 13, 2012 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? Quote Link to comment https://forums.phpfreaks.com/topic/264107-clean-upspeed-up-help/ Share on other sites More sharing options...
abdfahim Posted June 13, 2012 Share Posted June 13, 2012 isn't this belong to JavaScript forum? Quote Link to comment https://forums.phpfreaks.com/topic/264107-clean-upspeed-up-help/#findComment-1353474 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.