perfekt !
Countdown
Einklappen
X
-
Hi
Ich hab da ne einfacherere Lösung:
Hier das JAvascript:
Code:[b]g_timer = new Array(); function setDivText(c1, text) { document.getElementById(c1).innerHTML=text; } function addTimer(seconds, divName) { for (i=0; i<g_timer.length; i++) { if (g_timer[i] == -1) break; } g_timer[i] = seconds; g_timer[i+1] = divName; } function countdown() { len = g_timer.length*2; for (i=0; i<len;i+=2) { if (g_timer[i] > 0) { if (--g_timer[i] > 0) { lSeconds = g_timer[i]%60; // bisserl komplizierte Formatierung lMinutes = Math.floor(g_timer[i] / 60); lHours = Math.floor(lMinutes / 60); lMinutes%=60; lMinutes= ((lMinutes<10)? "0" : "" ) + (lMinutes); lSeconds =((lSeconds<10)?"0":"") + (lSeconds); var ebene=g_timer[i+1]; setDivText(ebene, "<span class='timer'>" + lHours + ":" + lMinutes + ":" + lSeconds +"</span>"); } else { setDivText(g_timer[i+1], "<span class='timer'>[fertig]</span>"); g_timer[i]=-1; // als 'wieder frei' markieren } } } setTimeout("countdown()", 999); } countdown(); [/b]
PHP-Code:echo "<DIV id=t1 style=\"DISPLAY: inline\" width=\"1\">".gmdate("G:i:s" , $restzeit1)."</DIV>
<SCRIPT type=text/javascript>addTimer($restzeit1, \"t1\");</SCRIPT>  Stunden";
echo "<DIV id=t2 style=\"DISPLAY: inline\" width=\"1\">".gmdate("G:i:s" , $restzeit2)."</DIV>
<SCRIPT type=text/javascript>addTimer($restzeit2, \"t2\");</SCRIPT>  Stunden";
Musst nur alles umbasteln ...
Gruss
framix
Kommentar
Kommentar