-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
63 lines (55 loc) · 4.9 KB
/
Copy pathindex.html
File metadata and controls
63 lines (55 loc) · 4.9 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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="styles.css" />
<link rel="stylesheet" type="text/css" href="toggle.css" />
<meta http-equiv="Permissions-Policy" content="browsing-topics=(self)">
<title>Trova la spia - Paolo's Game</title>
</head>
<body>
<div class="container" id="welcome_title">
<h1 class="title">Welcome</h1>
<label for="numeroGiocatori">Inserisci il numero di giocatori:</label>
<input type="number" min="0" step="1" name="numeroGiocatori" id="numeroGiocatori">
</div>
<label>
<span id="nGiocatori">Per giocare seleziona almeno 3 giocatori!</span>
<span id="N"></span>
</label>
<div id="start-id" class="start-container" style="display: none;">
<button onclick="start()">Start</button>
</div>
<div class="dark-mode-container">
<label class="dark-mode-toggle" for="darkModeCheckbox">
<input type="checkbox" id="darkModeCheckbox">
<div class="slider round"></div>
<span class="dark-mode-label" id="darkModeLabel">Night</span>
<span class="light-mode-label" id="lightModeLabel">Day</span>
</label>
</div>
<script>
const inputbox = document.getElementById("numeroGiocatori");
inputbox.addEventListener("change", (event)=>{
let N = event.target.value;
if (parseInt(N)>=3) {
document.getElementById("start-id").style.display = "flex";
document.getElementById("nGiocatori").innerHTML = "Giocatori selezionati: ";
document.getElementById("N").innerHTML = N;
} else {
document.getElementById("start-id").style.display = "none";
document.getElementById("nGiocatori").innerHTML = "Per giocare seleziona almeno 3 giocatori!";
document.getElementById("N").innerHTML = "";
}
});
const darkModeCheckbox = document.getElementById("darkModeCheckbox");
darkModeCheckbox.addEventListener("change", () => {
document.body.classList.toggle("dark-mode", darkModeCheckbox.checked);
});
function start() {
val1 = document.getElementById("N").innerHTML;
val2 = document.getElementById("darkModeCheckbox").checked;
window.location.href = "game.html?N="+val1+"&Mode="+val2;
}
</script>
</body>
</html>