-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquestionnaire.html
69 lines (66 loc) · 3.85 KB
/
questionnaire.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Interactive Questionnaire</title>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
<script>
function checkAnswer(question, correctOption, correctAnswer) {
const selectedOption = document.querySelector(`input[name="question${question}"]:checked`);
const feedback = document.getElementById(`feedback${question}`);
if (selectedOption) {
if (selectedOption.value === correctOption) {
feedback.textContent = "Congratulations! That is right!";
} else {
feedback.textContent = `Nice Try! It's actually ${correctAnswer}.`;
}
} else {
feedback.textContent = "Please select an option.";
}
}
</script>
</head>
<body style="font-family: 'Inter', sans-serif; margin: 20px; background: linear-gradient(to right, #55CDFC, #F7A8B8, #fff, #F7A8B8, #55CDFC); color: black;">
<h1>Interactive Questionnaire</h1>
<div class="question" style="margin-bottom: 20px; background: rgba(255, 255, 255, 0.8); padding: 20px; border-radius: 10px;">
<h2>Question 1: Which pet is better?</h2>
<div class="options" style="margin: 10px 0;">
<input type="radio" id="q1a1" name="question1" value="1">
<label for="q1a1">Dogs</label><br>
<input type="radio" id="q1a2" name="question1" value="2">
<label for="q1a2">Cats</label><br>
<input type="radio" id="q1a3" name="question1" value="3">
<label for="q1a3">Can't compare</label><br>
</div>
<button onclick="checkAnswer(1, '3', 'Can\'t compare')" style="margin: 5px; padding: 10px; font-size: 16px; cursor: pointer; background-color: #000; color: #fff; border: none; border-radius: 5px;">Submit Answer</button>
<div id="feedback1" style="margin-top: 10px;"></div>
</div>
<div class="question" style="margin-bottom: 20px; background: rgba(255, 255, 255, 0.8); padding: 20px; border-radius: 10px;">
<h2>Question 2: Which meal is better?</h2>
<div class="options" style="margin: 10px 0;">
<input type="radio" id="q2a1" name="question2" value="1">
<label for="q2a1">Breakfast</label><br>
<input type="radio" id="q2a2" name="question2" value="2">
<label for="q2a2">Lunch</label><br>
<input type="radio" id="q2a3" name="question2" value="3">
<label for="q2a3">Dinner</label><br>
</div>
<button onclick="checkAnswer(2, '3', 'Dinner')" style="margin: 5px; padding: 10px; font-size: 16px; cursor: pointer; background-color: #000; color: #fff; border: none; border-radius: 5px;">Submit Answer</button>
<div id="feedback2" style="margin-top: 10px;"></div>
</div>
<div class="question" style="margin-bottom: 20px; background: rgba(255, 255, 255, 0.8); padding: 20px; border-radius: 10px;">
<h2>Question 3: Which project management tool is the best?</h2>
<div class="options" style="margin: 10px 0;">
<input type="radio" id="q3a1" name="question3" value="1">
<label for="q3a1">Jira</label><br>
<input type="radio" id="q3a2" name="question3" value="2">
<label for="q3a2">Asana</label><br>
<input type="radio" id="q3a3" name="question3" value="3">
<label for="q3a3">Trello</label><br>
</div>
<button onclick="checkAnswer(3, '1', 'Jira')" style="margin: 5px; padding: 10px; font-size: 16px; cursor: pointer; background-color: #000; color: #fff; border: none; border-radius: 5px;">Submit Answer</button>
<div id="feedback3" style="margin-top: 10px;"></div>
</div>
</body>
</html>