Сообщение от j0hnik
|
FotGOD,
сделайте минимальный макет
|
чтото типа такого я пробовал:
function timer() {
let day = document.getElementById('day_id').value;
let hour = document.getElementById('hour_id').value;
let minute = document.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(seconds==0){
minutes--;
}
if(minutes==0&&seconds==0)
{
hours--;
}
if (diff <= 0) {
st = window.open("http://google.com");
} else {
st = `${days} days, ${hours} hours,${minutes}minutes,${seconds}seconds`;
}
document.getElementById("showtime").innerHTML = st;
}
document.getElementById('start').addEventListener('click', () => setInterval(timer, 1000));
timer();