-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.html
More file actions
46 lines (42 loc) · 1.48 KB
/
timer.html
File metadata and controls
46 lines (42 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html>
<head>
<title>Timer Page</title>
<script>
let timeLeft = 300; // Time in seconds (5 minutes)
let timerId;
let surveyUrl = "YOUR_SURVEY_MONKEY_URL"; // Replace with your SurveyMonkey URL
function startTimer() {
timeLeft = 300; // Reset time to 5 minutes
updateTimer();
timerId = setInterval(updateTimer, 1000); // Update every second
}
function updateTimer() {
let minutes = Math.floor(timeLeft / 60);
let seconds = timeLeft % 60;
document.getElementById("timer").innerHTML = minutes + "m " + seconds + "s ";
if (timeLeft <= 0) {
clearInterval(timerId);
document.getElementById("surveyPrompt").style.display = "block";
}
timeLeft -= 1;
}
function openSurvey() {
window.open(surveyUrl, "_blank"); // Open survey in a new tab
document.getElementById("surveyPrompt").style.display = "none"; // Hide the prompt
startTimer(); // Restart the timer
}
window.onload = function() {
startTimer();
};
</script>
</head>
<body>
<h1>Time Remaining</h1>
<div id="timer">5m 0s</div>
<div id="surveyPrompt" style="display:none;">
<p>Please complete the survey:</p>
<button onclick="openSurvey()">Go to Survey</button>
</div>
</body>
</html>