Its possible to add a counter in this time message?
You have to wait 13 minutes, 31 seconds till next download
So people don't need to refresh the page to see how many time need to wait till next download?
thank you

You have to wait 13 minutes, 31 seconds till next download
Code: Select all
<html>
<head>
<script type="text/javascript">
var Timer = 0;
var period = 1000;
var n = 61;
function initCountDown()
{
Timer = setInterval("countDown()", period);
}
function countDown()
{
var o = document.getElementById("myTimer");
var minutes = parseInt(n / 60);
var seconds = n % 60;
var minutes_str = "minutes";
if (minutes == 1) {
minutes_str = "minute";
}
var seconds_str = "seconds";
if (seconds == 1) {
seconds_str = "second";
}
if (n) {
o.innerHTML = "<p>You have to wait " + minutes + " " + minutes_str + ", " + seconds + " " + seconds_str + " till next download</p>\n";
n--;
}
else {
clearInterval(Timer);
o.innerHTML = "<p>Enjoy.</p>\n";
}
}
</script>
</head>
<body onload="initCountDown();">
<div id="myTimer">
</div>
</body>
</html>
mrperl wrote:Here's an example with a delay displayed in seconds:]