godzina = (godzina < 10) ? "0" + godzina : godzina; minuta = (minuta < 10) ? "0" + minuta : minuta; sekunda = (sekunda < 10) ? "0" + sekunda : sekunda;
WALIDATOR na tych liniach wywala mi :
Cytat
Line 26, Column 21: character "<" is the first character of a delimiter but occurred as data
godzina = (godzina < 10) ? "0" + godzina : godzina;
✉
This message may appear in several cases:
You tried to include the "<" character in your page: you should escape it as "<"
You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&", which is always safe.
Another possibility is that you forgot to close quotes in a previous tag.
godzina = (godzina < 10) ? "0" + godzina : godzina;
✉
This message may appear in several cases:
You tried to include the "<" character in your page: you should escape it as "<"
You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&", which is always safe.
Another possibility is that you forgot to close quotes in a previous tag.
Jak się tego pozbyć ?
piszę w XHTML 1.0 STRICT
Oraz jak zastąpić NAME w skrypcie który odnosi się do FORM ? - w XHTML nie ma takiego atrybutu ... A nie przechodzi mi nic do głowy jak mógłbym ot zastąpić, odnosi się do tego samego skryptu który wyświetla aktualną godzinę.
Cały skrypt :
function aktualnyCzas() { teraz = new Date(); godzina = teraz.getHours(); minuta = teraz.getMinutes(); sekunda = teraz.getSeconds(); godzina = (godzina < 10) ? "0" + godzina : godzina; minuta = (minuta < 10) ? "0" + minuta : minuta; sekunda = (sekunda < 10) ? "0" + sekunda : sekunda; czas = godzina + ":" + minuta + ":" + sekunda; document.zegar.wyswietlacz.value = czas; setTimeout("aktualnyCzas()",1000); }
Wyświetlenie :