-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
19 lines (17 loc) · 699 Bytes
/
Copy pathscript.js
File metadata and controls
19 lines (17 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const launchButton = document.getElementById("launch-btn");
const dateInput = document.getElementById("destination-date");
const display = document.getElementById("timer-display");
launchButton.addEventListener('click', function() {
const userChoice = dateInput.value;
if (userChoice === "") {
alert("Please select your destination");
} else {
setInterval(function() {
const now = new Date();
const destination = new Date(userChoice);
const delta = destination - now;
const totalSeconds = Math.floor(delta / 1000);
display.innerText = "T-Minus: " + totalSeconds + " seconds";
}, 1000);
}
});