-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathquestion8.html
More file actions
77 lines (71 loc) · 2.35 KB
/
question8.html
File metadata and controls
77 lines (71 loc) · 2.35 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
71
72
73
74
75
76
77
<!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">8 / 15</div>
<div class="question-container">
<div id="question"></div>
<div id="answers">
<div>
<img class="answer-image" />
<img class="answer-image" />
</div>
<div>
<img class="answer-image" />
<img class="answer-image" />
</div>
</div>
</div>
<div class="button-container">
<button class="switch" onclick="next()">weiter</button>
</div>
<script>
var answerImageElements = document.getElementsByClassName("answer-image");
var nextButton = document.querySelector("div.button-container button");
nextButton.disabled = true;
const correctAnswerNumber = 1;
function next() {
document.location.href = "question9.html";
}
function displayBorders() {
for (var i = 0; i < answerImageElements.length; i++) {
answerImageElements[i].style.padding = "2px";
answerImageElements[i].disabled = true;
answerImageElements[i].onclick = () => {
};
if (i === correctAnswerNumber) {
answerImageElements[i].style.border = "3px solid #10da10"
} else {
answerImageElements[i].style.border = "3px solid #d33e3e"
}
}
nextButton.disabled = false;
}
//question and answers
var questionText = "Wer beschwört im Raum der Wünsche das Dämonsfeuer?";
var answerImages = [
"images/Draco Malfoy.png",
"images/Vincent Crabbe.png",
"images/Blaise Zabini.png",
"images/Ronald Weasley.png",
];
//question text
var questionElement = document.getElementById("question");
questionElement.innerText = questionText;
//answer images
for (var i = 0; i < answerImageElements.length; i++) {
answerImageElements[i].src = answerImages[i];
answerImageElements[i].style.padding = "5px";
answerImageElements[i].style.border = "none"
answerImageElements[i].onclick = () => {
displayBorders();
};
answerImageElements[i].disabled = false;
}
</script>
</body>
</html>