Code:
{
var jetzt = new Date();
var Serverzeit= "Sa 12:01:00";
var Wochentagjetzt = new Array();
var stdjetzt = new Array();
var minjetzt = new Array();
var datum = new Array();
var tage = new Array();
var std = new Array();
var min = new Array();
var sek = new Array();
var wochentage = new Array("So","Mo","Di","Mi","Do","Fr","Sa");
Wochentagjetzt = Serverzeit.slice(0,2);
minjetzt = Serverzeit.slice(6,8);
stdjetzt = Serverzeit.slice(3,5);
datum[1] = Wochentagjetzt+", "+stdjetzt+":"+minjetzt+":00";
if(Wochentagjetzt=="Mo") { datum[0] = "Di, 12:00"; }
if(Wochentagjetzt=="Di") { datum[0] = "Mi, 12:00"; }
if(Wochentagjetzt=="Mi") { datum[0] = "Do, 12:00"; }
if(Wochentagjetzt=="Do") { datum[0] = "Fr, 12:00"; }
if(Wochentagjetzt=="Fr") { datum[0] = "Sa, 12:00"; }
if(Wochentagjetzt=="Sa") { datum[0] = "Di, 12:00"; }
if(Wochentagjetzt=="So") { datum[0] = "Di, 12:00"; }
if(Wochentagjetzt=="So") { Wochentagjetzt = "0"; }
if(Wochentagjetzt=="Mo") { Wochentagjetzt = "1"; }
if(Wochentagjetzt=="Di") { Wochentagjetzt = "2"; }
if(Wochentagjetzt=="Mi") { Wochentagjetzt = "3"; }
if(Wochentagjetzt=="Do") { Wochentagjetzt = "4"; }
if(Wochentagjetzt=="Fr") { Wochentagjetzt = "5"; }
if(Wochentagjetzt=="Sa") { Wochentagjetzt = "6"; }
for(i=0; i<=datum.length-1; i++)
{
tage[i] = datum[i].slice(0,2);
std[i] = datum[i].slice(4,6);
min[i] = datum[i].slice(7,9);
sek[i] = datum[i].slice(10,12);
for(j=0; j<=wochentage.length; j++)
{
if(tage[i] == wochentage[j])
{
tage[i] = j;
}
}
sek[i] = sek[i] - jetzt.getSeconds();
if(sek[i] < 0) { min[i]--; sek[i] = 60 + sek[i]; }
if(sek[i] < 10) sek[i] = "0" + sek[i];
min[i] = min[i] - minjetzt;
if(min[i] < 0) { std[i]--; min[i] = 60 + min[i]; }
if(min[i] < 10) min[i] = "0" + min[i];
std[i] = std[i] - stdjetzt;
if(std[i] < 0) { tage[i]--; std[i] = 24 + std[i]; }
if(std[i] < 10) std[i] = "0" + std[i];
tage[i] = tage[i] - Wochentagjetzt;
document.formular.feld1.value = "Jetzt "+ datum[1] +"\n bis "+ datum[0] + "\nBestellen Sie in :\n "+ tage[0] +" Tage,\n "+ std[0] +" Stunden,\n "+ min[0] +" Minuten\n";
}
} |