Oh LOL ich Vogel
DANKE! Jetzt gehta !
Danke danke! stimmt... sollte man schon umdrehen ^^
Uhrzeit per Java! Problem bei < 10
Einklappen
X
-
Re: Uhrzeit per Java! Problem bei < 10
Original geschrieben von MaximusMR
Code:document.theClock.theTime.value = "" + MinAusgabe ":" + SdtAusgabe;
Code:document.theClock.theTime.value = StdAusgabe + ":" + MinAusgabe;
Einen Kommentar schreiben:
-
Uhrzeit per Java! Problem bei < 10
also ich habe folgendes Problem. Ich habe auf meine Homepage eine Uhr eingebaut, nur ist wenn man eine Zahl < 10 hat nur die einzelne zahl und keine 0 davor. Also 09:07 ist dann 9:7 und das sieht scheiße aus
Hier mal der Quellcode!
PHP-Code:<script language="JavaScript">
<!--
var clockID = 0;
function UpdateClock() {
if(clockID) {
clearTimeout(clockID);
clockID = 0;
}
var tDate = new Date();
document.theClock.theTime.value = ""
+ tDate.getHours() + ":"
+ tDate.getMinutes() + ":"
+ tDate.getSeconds();
clockID = setTimeout("UpdateClock()", 1000);
}
function StartClock() {
clockID = setTimeout("UpdateClock()", 500);
}
function KillClock() {
if(clockID) {
clearTimeout(clockID);
clockID = 0;
}
}
//-->
</script>
PHP-Code:<script language="JavaScript">
<!--
var clockID = 0;
function UpdateClock() {
if(clockID) {
clearTimeout(clockID);
clockID = 0;
}
var tDate = new Date();
var Std = tDate.getHours();
var Min = tDate.getMinutes();
var MinAusgabe = ((Min < 10) ? "0" + Min : Min);
var StdAusgabe = ((Std < 10) ? "0" + Std : Std);
document.theClock.theTime.value = ""
+ MinAusgabe ":"
+ SdtAusgabe;
clockID = setTimeout("UpdateClock()", 1000);
}
function StartClock() {
clockID = setTimeout("UpdateClock()", 500);
}
function KillClock() {
if(clockID) {
clearTimeout(clockID);
clockID = 0;
}
}
//-->
</script>
Stichworte: -
Einen Kommentar schreiben: