Events CountDown Timer Script
have Events CountDown Timer jquery script?
i use this:
<font color="#ff6600">Devil Square:</font>
<font color='#DDA943'>
<span id=timespan>
<script>
var dods;
<?
echo "var minute = ".date("i").";";
echo "var secundes = ".date("s").";";
?>
//document.write(55-minute);
dsin = minute * 60 + secundes;
function changeeventtime()
{
dsin = dsin + 1;
dods = 55*60 - dsin;
min = Math.floor(dods/60);
sec = dods%60;
if(dods < 0)
{
document.getElementById("timespan").innerHTML="Open";
}
else
{
if(min < 10) min = "0"+min;
if(sec < 10) sec = "0"+sec;
document.getElementById("timespan").innerHTML=min+":"+sec;
}
window.setTimeout("changeeventtime()",1000);
}
changeeventtime();
</script>
</span>
</font>
but my EVENT TIME for DEVIL SQUARE is:
0 30
3 30
6 30
9 30
12 30
15 30
18 30
21 30
and my script show every hour.
have other script or how to modify this with my config
Re: Events CountDown Timer Script
Oh this is fun....
The reason your code is only counting down by the hour is because the counter is being set by:
[dods=55*60-dsin] (this is making the "counter" start from ~approx(55 mins) in seconds of course.
The simplest way I can think of fixing it is to [since you seem to use JS more then PHP] is to use a few [IFs] make ranges between your start times and current time and then set the {55*60} part of your code to the difference between the two times.....
If that made no sense then here is a cut throat explanation:
[Time Event starts]-[Current Time]=[Time Left] You will probably need 3 or 4 [IFs] I figure...
Or you can go full PHP and do a [SWITCH] with case expressions and that will save you a few lines..
Let me know if this helps ya.:ehh:
Oh a bit rude of me.... If you show some effort in figuring it out. I will help you rewrite it...
------------------------SD now and ALWAYS---------------------
Re: Events CountDown Timer Script
PHP Code:
<span id=dstime>
<script type="text/javascript">
var ds;
var acum = new Date();
var minutes = acum.getMinutes();
var seconds = acum.getSeconds();
dsstart = minutes * 60 + seconds;
if (minutes > 30) doin = 3600 - dsstart;
else doin = -dsstart;
ds = doin + 25*60;
function bceventtime()
{
ds = ds - 1;
if (ds < -5*60)
{
ds = 3600 + 30*60;
ds = ds-1;
}
min = Math.floor(ds/60);
sec = ds%60;
if (min < 0)
{
document.getElementById("dstime").innerHTML = "Open";
}
else
{
if (min < 10) min = "0"+min;
if (sec < 10) sec = "0"+sec;
document.getElementById("dstime").innerHTML = min+":"+sec;
}
window.setTimeout("dseventtime()",1000);
}
dseventtime();
</script>
</span>
This is my default code for Devil Square, this code was for 00 time but my DS is at 30 minutes, and in line ds i put this "doin + 25*60;" for event start at 30 minutes, this work for minutes, but for hours i try to change line: dsstart = minutes * 60 + seconds; to dsstart = minutes * 180 + seconds; for every 3 hours but this not work:( show other time.