Answer the question
In order to leave comments, you need to log in
Why is NaN displayed instead of numbers in JS timer in Safari?
There was a problem. Created a JS timer. It works correctly in all browsers, and Safari writes NaN instead of numbers. There are no errors in the console. I am attaching the timer code.
<script>
var YearS = 0;
var MonthS = 0;
var DayS = 0;
var HourS = 0;
var MinS = 0;
function updatecountdown() {
var now = new Date();
timeN = (now.getMinutes()) + now.getHours() + now.getDate() + now.getMonth() + now.getFullYear();
time = (MinS-1) + HourS + DayS + MonthS + YearS;
if(time == timeN){
window.location.reload();
}
setTimeout(updatecountdown, 1000);
}
updatecountdown();
var deadline= <? echo '"'.$mm.' '.$dd.' '.$yy.' '.$hh.':'.$mi.':00"'; ?>;
initializeClock('countdown', deadline);
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question