Saturday, 4 April 2015

Timer_code _in_Javascript

<html>
<head>

<script>

var seconds = 60;


function secondPassed()

{
    var minutes = Math.round((seconds - 30)/60);


    var remainingSeconds = seconds % 60;


    if (remainingSeconds < 10)

{
        remainingSeconds = "0" + remainingSeconds;
    }


    document.getElementById('countdown').innerHTML = minutes + ":" + remainingSeconds;



    if (seconds == 0)


{

        clearInterval(countdownTimer);
        document.getElementById('countdown').innerHTML = "Buzz Buzz";

window.location.href="om.txt";

    }

else

{

        seconds--;

    }
}



var countdownTimer = setInterval('secondPassed()', 1000);


</script>

</head>

<body>
<span id="countdown" class="timer"></span>

</body>

</html>

No comments:

Post a Comment