hi, sorry this post is so long, lol
I have a download page, which I want users to wait a certain amount of time before they can download, waiting time depends on the queue wait time, say each user has to wait 30 seconds, and there are 10 users waiting, then the last user will have to wait 3 minutes.
I have this javascript function to do the math, the bold code is part of the Dynamic countdown script at dynamicdrive ([URL=”http://www.dynamicdrive.com/dynamicindex6/dhtmlcount.htm”]here
and the bold italic code is from the Dynamic collapse at dynamicdrive ([URL=”http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm”]here
[CODE]
<script>
function build(src, text, sec) {
var d = new Date();
var L = new Array(“January”,”February”,”March”,”April”,”May”,”June”,”July”,”August”,”September”,”October”,”November”,”December”);
var F = L[d.getMonth()];
var P = new Array(“01″,”02″,”03″,”04″,”05″,”06″,”07″,”08″,”09″,”10″,”11″,”12″,”13″,”14″,”15″,”16″,”17″,”18″,”19″,”20″,”21″,”22″,”23″,”24″,”25″,”26″,”27″,”28″,”29″,”30″,”31″);
var j = P[d.getDate()];
var y = d.getFullYear();
var H = d.getHours();
var i = d.getMinutes();
var s = d.getSeconds() + sec;
var DATE = F+” “+j+”, “+y+” “+H+”:”+i+”:”+s;
[B]var futuredate=new cdtime(“build”+src+”Counter”, DATE);
futuredate.displaycountdown(“days”, formatresults);
[/B]
document.getElementById(“build”+src+”TEXT”).innerHTML = text;
[B][I]animatedcollapse.show(“build”+src);[/I][/B]
}
</script>
<img src=”images/download.png” onclick=”build(‘1’, ‘Mozilla Firefox’, ’30’);” />
<div id=”build1″ style=”width:400px; background: url(‘images/modalBG.png’); display:none; padding:2px 5px;”>
<span style=’float:right; border:0; background:transparent; width:150px;’ id=’build1Counter’></span>
<div id=”build1TEXT”></div>
</div>
when the user clicks the download image the timer slides up at the bottom of the page, with the name of the download as the “build1TEXT” and the countdown in “build1Counter”, but for some reason the counter says undefined if the “secs” go over 60… the problem is obviously in my build function at this line “var s = d.getSeconds() + sec;”, I thought if the seconds went into minutes it would add one to the minutes but it doesn’t seem to, is there anyway of doing this, seconds to minutes, minutes to hours and hours to days, as I have another use for it if anyone can sort the problem out.
?? thank you in advance ??
edit:
ok it just seems to display the finish message from DD’s countdown script…