Skip to content

Commit bb03f01

Browse files
Merge pull request #802 from RUDRESH2825/patch-3
Create find me a cat
2 parents 56b54ed + bbffc8f commit bb03f01

File tree

1 file changed

+103
-0
lines changed

1 file changed

+103
-0
lines changed

find me a cat

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
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>Which Cat Breed Should I Choose?</title>
7+
<style>
8+
body {
9+
font-family: Arial, sans-serif;
10+
background-color: #f9f9f9;
11+
text-align: center;
12+
margin: 0;
13+
padding: 0;
14+
}
15+
h1 {
16+
color: #333;
17+
}
18+
.container {
19+
margin: 50px auto;
20+
width: 50%;
21+
background-color: #fff;
22+
padding: 20px;
23+
border-radius: 10px;
24+
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
25+
}
26+
label {
27+
display: block;
28+
margin: 20px 0 10px;
29+
}
30+
select {
31+
padding: 10px;
32+
width: 100%;
33+
border-radius: 5px;
34+
border: 1px solid #ccc;
35+
}
36+
button {
37+
background-color: #007bff;
38+
color: white;
39+
padding: 10px 20px;
40+
border: none;
41+
border-radius: 5px;
42+
cursor: pointer;
43+
margin-top: 20px;
44+
}
45+
button:hover {
46+
background-color: #0056b3;
47+
}
48+
.result {
49+
margin-top: 20px;
50+
font-weight: bold;
51+
color: #007bff;
52+
}
53+
</style>
54+
</head>
55+
<body>
56+
<h1>Which Cat Breed Should I Choose?</h1>
57+
<div class="container">
58+
<form id="catQuizForm">
59+
<label for="personality">What's your personality like?</label>
60+
<select id="personality">
61+
<option value="">Select...</option>
62+
<option value="active">Active</option>
63+
<option value="laidback">Laid-back</option>
64+
<option value="introverted">Introverted</option>
65+
<option value="extroverted">Extroverted</option>
66+
</select>
67+
<label for="location">Where do you live?</label>
68+
<select id="location">
69+
<option value="">Select...</option>
70+
<option value="apartment">Apartment</option>
71+
<option value="suburb">Suburb</option>
72+
<option value="rural">Rural</option>
73+
</select>
74+
<button type="button" onclick="getCatBreed()">Find My Cat Breed!</button>
75+
</form>
76+
<div class="result" id="result"></div>
77+
</div>
78+
<script>
79+
function getCatBreed() {
80+
const personality = document.getElementById('personality').value;
81+
const location = document.getElementById('location').value;
82+
let breed = "";
83+
84+
if (personality === "active" && location === "apartment") {
85+
breed = "Bengal";
86+
} else if (personality === "laidback" && location === "suburb") {
87+
breed = "British Shorthair";
88+
} else if (personality === "introverted" && location === "rural") {
89+
breed = "Maine Coon";
90+
} else if (personality === "extroverted" && location === "apartment") {
91+
breed = "Siamese";
92+
} else if (personality === "extroverted" && location === "suburb") {
93+
breed = "Sphynx";
94+
} else if (personality === "introverted" && location === "apartment") {
95+
breed = "Scottish Fold";
96+
} else {
97+
breed = "Any friendly breed!";
98+
}
99+
document.getElementById('result').innerHTML = `You should choose a: <strong>${breed}</strong>`;
100+
}
101+
</script>
102+
</body>
103+
</html>

0 commit comments

Comments
 (0)