Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [JavaScript] setInterval i proste odliczanie czasu
-EdeusEx~-
post
Post #1





Goście







Mam kod js:
Cytat
<script>
function timerOn(string) {
explode = string.split(":");
custom_date = explode[0];
custom_minutes = explode[1];
custom_seconds = explode[2];

cDate = new Date();
Hours = cDate.getHours();
Minutes = cDate.getMinutes();
Seconds = cDate.getSeconds();
document.getElemenById('time').innerHTML = Hours+':'+Minutes+':'+Seconds;
}

setInterval(timerOn, 1000);
</script>


Oraz HTML dokładnie pod tym:
Cytat
<body onLoad="timerOn('{$time}')">
<input type="hidden" id="timer_begin" value="{$time}">
<table width="70%" align="center">
<tr><td align="center" width="86%"><B>{$action_title}</B></td> <td><img src="icons/small/clock.png"> <div id="time"></div></tr>
<tr><td style="padding: 5px 5px;" colspan="2">{$text}</td></tr>
</table>


pytania:

1. dlaczego pisze, ze "string.split nie jest funkcja" ?
2. jezeli wywale nawet czesc rozwalania stringa, bedzie "document.getElementById nie jest funkcją"
3. czy ktos to umie naprawic?
Go to the top of the page
+Quote Post
lord_t
post
Post #2





Grupa: Zarejestrowani
Postów: 603
Pomógł: 131
Dołączył: 24.07.2007
Skąd: Górny Śląsk

Ostrzeżenie: (0%)
-----


1. tego to nie wiem
2. bo masz '..Elemen..' a nie '..Element..'
Go to the top of the page
+Quote Post
--EdeusEx~--
post
Post #3





Goście







Dobrze, literówki nie zauwazylem, ale co w takim razie ze split?
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 22.08.2025 - 23:55