-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcount.js
More file actions
64 lines (46 loc) · 1.72 KB
/
count.js
File metadata and controls
64 lines (46 loc) · 1.72 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
function updatePlayerName() {
const playerName = sessionStorage.getItem('username');
const playerElement = document.getElementById('player');
if (playerElement) {
playerElement.innerHTML = playerName ? playerName : 'Guest';
}
}
updatePlayerName();
const lifeline1Used = sessionStorage.getItem('lifeline1_used');
// Disable lifeline 1 button if it has already been used
if (lifeline1Used) {
document.getElementById('lifeline1').disabled = true;
}
const lifeline2Used = sessionStorage.getItem('lifeline2_used');
// Disable lifeline 1 button if it has already been used
if (lifeline2Used) {
document.getElementById('lifeline2').disabled = true;
}
const lifeline3Used = sessionStorage.getItem('lifeline3_used');
// Disable lifeline 1 button if it has already been used
if (lifeline3Used) {
document.getElementById('lifeline3').disabled = true;
}
document.getElementById('startkbc').onclick = function () {
window.location.href = "_2.html";
}
// Store the user's name in session storage
document.getElementById("registration-form").addEventListener("submit", function (event) {
// Prevent the default form submission behavior
event.preventDefault();
updateUsername();
redirectToFirstPage();
});
function redirectToFirstPage() {
setTimeout(function () {
window.location.href = "1.html"; // Replace "next_page.html" with the URL of your next page
}, 4000);
}
// Function to update username in sessionStorage
function updateUsername() {
const nameInput = document.getElementById('name');
if (nameInput) {
const username = nameInput.value;
sessionStorage.setItem('username', username);
}
}