-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
58 lines (49 loc) · 1.7 KB
/
index.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Number Guessing Game</title>
<!-- External CSS -->
<link rel="stylesheet" href="./style.css">
<link rel="stylesheet" href="../main.css">
<!-- Hiding the buttons -->
<style>
/* Hide the number input spinner */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
/* Optional styles to hide the number input arrow in Firefox */
input[type="number"] {
-moz-appearance: textfield;
appearance: textfield;
}
</style>
</head>
<body>
<div class="container">
<form>
<label for="num" id="title">Guess the Number</label> <br>
<input type="number" name="num" id="num" min="1" max="10" placeholder="Enter number between 1 - 10">
</form>
<br>
<button type="button" id="submitBtn">Check Number</button>
<button type="button" id="refreshBtn" style="display: none; color: goldenrod; background-color: #1D2A35;">New Game</button>
<p id="result"></p>
</div>
<script>
// Prevent form submission
const form = document.querySelector("form");
form.addEventListener("keydown", function (event) {
if (event.key === "Enter") {
event.preventDefault();
}
});
</script>
<!-- JavaScript -->
<script src="./script.js" defer></script>
</body>
</html>