Search

타이머

<script> (function () { const second = 1000, minute = second * 60, hour = minute * 60, day = hour * 24; function initializeTimer(topContainerId, countdownId, daysId, soonEndId, endDateString) { let today = new Date(), dd = String(today.getDate()).padStart(2, "0"), mm = String(today.getMonth() + 1).padStart(2, "0"), hh = String(today.getHours()).padStart(2, "0"), yyyy = today.getFullYear(); today = mm + "/" + dd + "/" + yyyy + " " + hh + ":00:00"; if (new Date(today) > new Date(endDateString)) { document.getElementById(topContainerId).style.display = "none"; return; } else { document.getElementById(topContainerId).style.display = "block"; } const countDown = new Date(endDateString).getTime(), x = setInterval(function () { const now = new Date().getTime(), distance = countDown - now; document.getElementById(daysId).innerText = Math.floor(distance / (day)) + " "; // 제한시간이 하루 남았을 때 if (distance < day && distance > 0) { document.getElementById(soonEndId).style.display = 'block'; } // 0일 땐 내용 안보이게 if (Math.floor(distance / day) === 0) { document.getElementById(daysId).parentNode.style.display = "none"; } // do something later when date is reached if (distance < 0) { document.getElementById("headline").innerText = "프로모션이 종료되었어요"; document.getElementById(countdownId).style.display = "none"; document.getElementById(topContainerId).style.display = "none"; clearInterval(x); } }, 1000); } initializeTimer('top_container1', 'countdown1', 'days1', 'soon_end1', "9/23/2024 22:00:00"); })(); </script>
HTML
복사

헤일리요청

여행 시작까지,

! 혜택 종료 임박 !