ASDV-WebDev/Semester 1/Assignments/JavaScript/lab13js_CalebFontenot/public_html/Problem1.html
2023-08-16 17:31:33 -05:00

31 lines
996 B
HTML

<!DOCTYPE html>
<!--
Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
Click nbfs://nbhost/SystemFileSystem/Templates/ClientSide/html.html to edit this template
-->
<html>
<head>
<title>Blastoff</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
async function countdown() {
var countdownLength = 5;
for (let i = countdownLength; i > 0; i--) {
document.write("Countdown in " + i + "..." + "<br>");
await sleep(1000);
}
document.write("BLASTOFF!");
}
</script>
</head>
</html>
<body>
<button id="countdown" onclick="countdown();">Start Countdown</button>
</body>