forked from swaraj-das/Collect-your-GamingTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rating.html
142 lines (119 loc) · 3.83 KB
/
rating.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Game Rating Page</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f0f0f0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.rating-container {
background-color: #fff;
padding: 50px;
border-radius: 100px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
width: 1000px;
text-align: center;
}
h2 {
color: #333;
}
.stars {
display: flex;
justify-content: center;
margin: 20px 0;
}
.stars input {
display: none;
}
.stars label {
font-size: 30px;
color: #ccc;
cursor: pointer;
}
.stars input:checked ~ label,
.stars label:hover,
.stars label:hover ~ label {
color: #ffcc00;
}
textarea {
width: 100%;
height: 100px;
margin-top: 10px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
resize: none;
}
button {
margin-top: 15px;
padding: 10px 20px;
background-color: #28a745;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #218838;
}
.result {
margin-top: 20px;
padding: 15px;
background-color: #f8f9fa;
border-radius: 5px;
display: none;
}
</style>
</head>
<body>
<div class="rating-container">
<h1>Rate our Games</h1>
<div class="stars">
<input type="radio" name="star" id="star1" value="5">
<label for="star1">★</label>
<input type="radio" name="star" id="star2" value="4">
<label for="star2">★</label>
<input type="radio" name="star" id="star3" value="3">
<label for="star3">★</label>
<input type="radio" name="star" id="star4" value="2">
<label for="star4">★</label>
<input type="radio" name="star" id="star5" value="1">
<label for="star5">★</label>
</div>
<textarea id="comment" placeholder="Leave a comment..."></textarea>
<button type="button" onclick="submitRating()">Submit Rating</button>
<div id="result" class="result">
<h3>Thank you for your rating 🤗</h3>
<p id="display-rating"></p>
<p id="display-comment"></p>
</div>
</div>
<script>
function submitRating() {
// Get selected rating
let rating = document.querySelector('input[name="star"]:checked');
let comment = document.getElementById('comment').value;
if (!rating) {
alert("Please select a rating.");
return;
}
// Display the rating and comment
document.getElementById('display-rating').textContent = "Rating: " + rating.value + " stars";
document.getElementById('display-comment').textContent = "Comment: " + (comment || "No comment provided.");
// Show the result section
document.getElementById('result').style.display = "block";
// Clear the form
document.querySelector('input[name="star"]:checked').checked = false;
document.getElementById('comment').value = '';
}
</script>
</body>
</html>