-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquestion12.html
More file actions
70 lines (66 loc) · 2.22 KB
/
question12.html
File metadata and controls
70 lines (66 loc) · 2.22 KB
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
<!DOCTYPE html>
<html lang="de">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Fragen</title>
<link rel="stylesheet" href="question.css"/>
</head>
<body>
<div class="switchContainer">12 / 15</div>
<div class="question-container">
<div id="question"></div>
<div id="timerContainer" style="display: none">
<h2 class="timer" id="timerText"></h2>
</div>
<div id="answers">
<button class="answer"></button>
<button class="answer"></button>
<button class="answer"></button>
<button class="answer"></button>
</div>
</div>
<div class="button-container">
<button class="switch" onclick="next()">weiter</button>
</div>
<script>
var nextButton = document.querySelector("div.button-container button");
nextButton.disabled = true;
const correctAnswerNumber = 1;
function next() {
document.location.href = "question13.html";
}
function displayBorders() {
var answerElements = document.getElementsByClassName("answer");
for (var i = 0; i < answerElements.length; i++) {
answerElements[i].disabled = true;
answerElements[i].onclick = () => {
};
if (i === correctAnswerNumber) {
answerElements[i].style.border = "3px solid #10da10"
} else {
answerElements[i].style.border = "3px solid #d33e3e"
}
nextButton.disabled = false;
}
}
var questionText =
"Welcher Zauberer ist der Autor von \"Fantastische Tierwesen und wo sie zu finden sind\"?";
var answers = [
"Albus Dumbledore",
"Newt Scamander",
"Gilderoy Lockhart",
"Severus Snape",
];
var questionElement = document.getElementById("question");
questionElement.innerText = questionText;
var answerButtons = document.getElementsByClassName("answer");
for (var i = 0; i < answerButtons.length; i++) {
answerButtons[i].innerText = answers[i];
answerButtons[i].style.border = "3px solid #4caf50";
answerButtons[i].onclick = () => {
displayBorders();
};
}
</script>
</body>
</html>