Hallo ich habe den untenstehenden Countdownzähler erstellt.
Jetzt möchte ich aber, dass wenn er wieder bei null steht, automatisch 14 Tage drauf rechnet...würde das gehen??? Also wenn die 14 Tage abgelaufen sind, müsste das nächste datum in 14 Tagen kommen..
<script language="JavaScript1.2">
var now = new Date();
var event = new Date("Mar 16 2005 19:30:00");
var mseconds, seconds, minutes, hours, days;
var tmseconds;
ID=window.setTimeout("update();", 10);
function update()
{
now = new Date();
mseconds = (event - now);
seconds = mseconds / 1000;
days = seconds / 86400;
days = Math.floor(days);
hours = (seconds - days * 86400) / 3600;
hours = Math.floor(hours);
minutes = ((seconds - (days * 86400 + hours * 3600)) / 60);
minutes = Math.floor(minutes);
seconds = ((seconds - (days * 86400 + hours * 3600 + minutes * 60)));
seconds = Math.floor(seconds);
mseconds = (mseconds - ((days * 86400 + hours * 3600 + minutes * 60 + seconds) * 1000));
mseconds /= 10;
mseconds = Math.floor(mseconds);
if(hours < 10)
hours = '0' + hours;
if(minutes < 10)
minutes = '0' + minutes;
if(seconds < 10)
seconds = '0' + seconds;
if(mseconds < 10)
mseconds = '0' + mseconds;
document.getElementById('x_days').innerHTML=days;
document.getElementById('x_hours').innerHTML=hours;
document.getElementById('x_minutes').innerHTML=minutes;
document.getElementById('x_seconds').innerHTML=seconds;
document.getElementById('x_mseconds').innerHTML=mseconds;
ID=window.setTimeout("update();",10);
}
</script>
<tr>
<td width="100"><b></b></td>
<td>Noch <span id="x_days"></span> Tag(e), <span id="x_hours"></span>std. <span id="x_minutes"></span>min. <span id="x_seconds"></span>sek. <span id="x_mseconds"></span>ms. bis zur nächsten Übung.</td>
</tr>
Jetzt möchte ich aber, dass wenn er wieder bei null steht, automatisch 14 Tage drauf rechnet...würde das gehen??? Also wenn die 14 Tage abgelaufen sind, müsste das nächste datum in 14 Tagen kommen..
<script language="JavaScript1.2">
var now = new Date();
var event = new Date("Mar 16 2005 19:30:00");
var mseconds, seconds, minutes, hours, days;
var tmseconds;
ID=window.setTimeout("update();", 10);
function update()
{
now = new Date();
mseconds = (event - now);
seconds = mseconds / 1000;
days = seconds / 86400;
days = Math.floor(days);
hours = (seconds - days * 86400) / 3600;
hours = Math.floor(hours);
minutes = ((seconds - (days * 86400 + hours * 3600)) / 60);
minutes = Math.floor(minutes);
seconds = ((seconds - (days * 86400 + hours * 3600 + minutes * 60)));
seconds = Math.floor(seconds);
mseconds = (mseconds - ((days * 86400 + hours * 3600 + minutes * 60 + seconds) * 1000));
mseconds /= 10;
mseconds = Math.floor(mseconds);
if(hours < 10)
hours = '0' + hours;
if(minutes < 10)
minutes = '0' + minutes;
if(seconds < 10)
seconds = '0' + seconds;
if(mseconds < 10)
mseconds = '0' + mseconds;
document.getElementById('x_days').innerHTML=days;
document.getElementById('x_hours').innerHTML=hours;
document.getElementById('x_minutes').innerHTML=minutes;
document.getElementById('x_seconds').innerHTML=seconds;
document.getElementById('x_mseconds').innerHTML=mseconds;
ID=window.setTimeout("update();",10);
}
</script>
<tr>
<td width="100"><b></b></td>
<td>Noch <span id="x_days"></span> Tag(e), <span id="x_hours"></span>std. <span id="x_minutes"></span>min. <span id="x_seconds"></span>sek. <span id="x_mseconds"></span>ms. bis zur nächsten Übung.</td>
</tr>
Kommentar