The clock works correctly, the time shows as it should, Only they stand still and do not tick a second, when the page is updated, the clock is updated as it should, and time shows normally. The question is how to start the clock so that they start ticking? and seconds went in real time when you were on the site, the clock is already connected to the timing zone - there is no problem. Help to start the clock so that they go (the second began to move). Thank you very much. here is the code
<script type="text/javascript"> function clock() { var d = new Date(<?=date("Y");?>, <?=(date("m")-1);?>, <?=date("d");?>, <?=date("H");?>, <?=date("i");?>, <?=date("s");?>); var month_num = d.getMonth() var day = d.getDate(); var hours = d.getHours(); var minutes = d.getMinutes(); var seconds = d.getSeconds(); month=new Array("января", "февраля", "марта", "апреля", "мая", "июня", "июля", "августа", "сентября", "октября", "ноября", "декабря"); if (day <= 9) day = "0" + day; if (hours <= 9) hours = "0" + hours; if (minutes <= 9) minutes = "0" + minutes; if (seconds <= 9) seconds = "0" + seconds; date_time = "Екатеринбург - " + day + " " + month[month_num] + " " + d.getFullYear() + " г. "+ hours + ":" + minutes + ":" + seconds; if (document.layers) { document.layers.doc_time.document.write(date_time); document.layers.doc_time.document.close(); } else { document.getElementById("doc_time").innerHTML = date_time; } setTimeout("clock()", 1000); } </script> <script type="text/javascript"> clock(); </script>
setTimeout("clock", 1000);
- Alexander Gribennikov