Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 93b55ad

Browse files
Guess
1 parent 84ff009 commit 93b55ad

File tree

3 files changed

+97
-0
lines changed

3 files changed

+97
-0
lines changed

‎QuizGameProject/app.js

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
let questions = [
2+
'Age Group Categorization',
3+
'Movie Ticket Pricing',
4+
'Grade Calculator',
5+
'Fruit Ripeness Checker',
6+
'Weather Activity Suggestion',
7+
'Transportation Mode Selection',
8+
'Coffee Customization',
9+
'Password Strength Checker',
10+
'Leap Year Checker',
11+
'Pet Food Recommendation',
12+
'Counting Positive Numbers',
13+
'Sum of Even Numbers',
14+
'Multiplication Table Printer',
15+
'Reverse a String',
16+
'Find the First Non-Repeated Character',
17+
'Factorial Calculator',
18+
'Validate Input',
19+
'Prime Number Checker',
20+
'List Uniqueness Checker',
21+
'Exponential Backoff',
22+
]
23+
console.log(questions[0]);
24+
25+
let allBoxes = document.getElementsByClassName('box')
26+
// console.log(allBoxes);
27+
28+
for( let i = 0 ; i < allBoxes.length ; i++){
29+
allBoxes[i].addEventListener('click',function(){
30+
// console.log(this);
31+
clearAll()
32+
this.style.backgroundColor = 'white'
33+
this.style.color = 'black'
34+
this.style.border = '1px solid black'
35+
this.innerText = questions[Math.floor(Math.random()*20)]
36+
37+
})
38+
}
39+
function clearAll() {
40+
for( let i = 0 ; i < allBoxes.length ; i++){
41+
allBoxes[i].style.backgroundColor = 'black'
42+
allBoxes[i].style.color = 'white'
43+
allBoxes[i].innerText = i + 1
44+
}
45+
}

‎QuizGameProject/index.html

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Quiz Game</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
<h1>GUESS GAME</h1>
11+
<div class="container">
12+
<div class="box">1</div>
13+
<div class="box">2</div>
14+
<div class="box">3</div>
15+
<div class="box">4</div>
16+
<div class="box">5</div>
17+
<div class="box">6</div>
18+
<div class="box">7</div>
19+
<div class="box">8</div>
20+
<div class="box">9</div>
21+
<div class="box">10</div>
22+
<div class="box">11</div>
23+
<div class="box">12</div>
24+
</div>
25+
<script src="app.js"></script>
26+
</body>
27+
</html>

‎QuizGameProject/style.css

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
h1{
2+
text-align: center;
3+
font-family: monospace;
4+
}
5+
.container{
6+
display: grid;
7+
grid-template-columns: repeat(3,1fr);
8+
width: 700px;
9+
margin: 10px auto;
10+
row-gap: 10px;
11+
place-items: center;
12+
}
13+
.box{
14+
height: 100px;
15+
width: 140px;
16+
display: flex;
17+
justify-content: center;
18+
align-items: center;
19+
font-size: 20px;
20+
color: white;
21+
background-color: black;
22+
cursor: pointer;
23+
text-align: center;
24+
transition: 0.6s ease-in all;
25+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /