Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<html>
  
  <head>
    <script>
var CountdownID = null;
var start_msecond = 9;
var start_sec = 4;
window.onload = function () {
   countDown(start_msecond, start_sec, "timerID");
}
function countDown(pmsecond, psecond, timerID) {
var msecond = ((pmsecond < 1) ? "" : "") + pmsecond;
var second = ((psecond < 9) ? "0": "") + psecond;
document.getElementById(timerID).innerHTML = second + "." + msecond;
if (second <= 0 && (msecond) <= 0) { //Recurse timer
   alert("Time is Up! Enter your PIN now to subscribe!");  
    clearTimeout(CountdownID);
    var command = "countDown("+start_msecond+", "+start_sec+", '"+timerID+"')";
    CountdownID = window.setTimeout(command, 100);
   
}
else { //Decrease time by one second
    --pmsecond;
    if (pmsecond < 0) {
        pmsecond=start_msecond;
           --psecond;
    }
    if (psecond < 0) {
        psecond=start_sec;
    }
    var command = "countDown("+pmsecond+", "+psecond+", '"+timerID+"')";
    CountdownID = window.setTimeout(command, 100);
}
}
    </script>
  </head>
  <body>
<span style="color:red" name="timerID" id="timerID">91.6</span>
  </body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers