benshepherd icon

javascript countdown

benshepherd | PRO | 02/14/13 10:18:52 PM UTC | 0 ⭐ | 312 👁️ | Never ⏰ | []
HTML |

370 B

|

None

|

0 👍

/

0 👎

<head>
<script>
function startCountdown(x) {
    if(x == 0) {
        document.getElementById("countdown").innerHTML = "take off!!!";
    } else {
        document.getElementById("countdown").innerHTML = "t-minus " + x;
        setTimeout(function() {
            startCountdown(x-1);
        }, 1000);
    }
}
</script>
</head>
 
<body onload="startCountdown(10)">
    <div id="countdown"></div>
</body>

Comments