Всем привет. Подскажите в чем проблема, где ошибки. Код не хочет работать.
<div class="container">
<h2>Home Work 2</h2>
<div class="box hide"></div>
<div id="showtime">00:00</div>
<button id="start" class="btn btn-primary">START</button>
<br>
<br>
<form name="form">
<div>
Day: <input id='day_id'>
</div>
<div>
hours: <input id='hour_id'>
</div>
<div>
minutes: <input id='minute_id'>
</div>
</form>
</div>
function timer(){
let day= getElementById('day_id').value;
let hour=getElementById('hour_id').value;
let minute=getElementById('minute_id').value;
let second=59;
const now = new Date()
, newTime = new Date(now.getFullYear()+ 1, 0, 1)
, diff = newTime.getTime() - now.getTime()
, days = day
, hours = hour
, minutes = minute
, seconds = 59 - now.getSeconds()
;
let st = '';
if(diff <= 0) {
st = window.open("http://google.com");
} else {
st=`${days} days, ${hours} hours,${minutes}minutes,${seconds}seconds`;
}
document.getElementById('start').addEventListener('click', timer);
document.getElementById("showtime").innerHTML = st;
setTimeout(timer, 1000);
}
timer();