Update
This commit is contained in:
@@ -54,6 +54,8 @@
|
||||
answer2.addEventListener('click', answerQuestion);
|
||||
|
||||
var startAudio = new Audio('spielstarten.mp3');
|
||||
var richtigAudio = new Audio('richtig.mp3');
|
||||
var falschAudio = new Audio('falsch.mp3');
|
||||
|
||||
//Start game
|
||||
function listener() {
|
||||
@@ -98,10 +100,12 @@ function answerQuestion(event) {
|
||||
console.log(target.nodeName);
|
||||
|
||||
if (target.id.substr(-1) == question.solution) {
|
||||
richtigAudio.play();
|
||||
console.log("richtig");
|
||||
target.style.backgroundColor = "green";
|
||||
rightAnswers++;
|
||||
} else {
|
||||
falschAudio.play();
|
||||
target.style.backgroundColor = "red";
|
||||
document.getElementById("answer" + question.solution).style.backgroundColor == "green";
|
||||
}
|
||||
|
Reference in New Issue
Block a user