diff --git a/MainPage/ismail/index.html b/MainPage/ismail/index.html new file mode 100644 index 0000000..8ddba24 --- /dev/null +++ b/MainPage/ismail/index.html @@ -0,0 +1,33 @@ + + + + + Mathematik Lernen + + + + +
+

Mathematik Lernen

+ +
+ + + +
+ +
+

Klicke auf eine Rechenart, um zu beginnen

+ + +

+
+ +
+ Punktzahl: 0 +
+
+ + + + \ No newline at end of file diff --git a/MainPage/ismail/script.js b/MainPage/ismail/script.js new file mode 100644 index 0000000..2228e1c --- /dev/null +++ b/MainPage/ismail/script.js @@ -0,0 +1,52 @@ +let num1, num2; +let correctAnswer; +let score = 0; +let currentMode = ""; + +function setMode(mode) { + currentMode = mode; + generateQuestion(); +} + +function generateQuestion() { + num1 = Math.floor(Math.random() * 10); + num2 = Math.floor(Math.random() * 10); + + if (currentMode === "addition") { + correctAnswer = num1 + num2; + document.getElementById("question").textContent = + `${num1} + ${num2} = ?`; + } + + if (currentMode === "subtraktion") { + correctAnswer = num1 - num2; + document.getElementById("question").textContent = + `${num1} - ${num2} = ?`; + } + + if (currentMode === "multiplikation") { + correctAnswer = num1 * num2; + document.getElementById("question").textContent = + `${num1} × ${num2} = ?`; + } + + document.getElementById("answer").value = ""; +} + +function checkAnswer() { + let userAnswer = Number(document.getElementById("answer").value); + let resultText = document.getElementById("result"); + + if (userAnswer === correctAnswer) { + resultText.textContent = + "✅ Richtig! Sehr gut! Die Antwort ist " + correctAnswer; + score++; + document.getElementById("score").textContent = score; + } else { + resultText.textContent = + "❌ Falsch! Die richtige Antwort ist " + correctAnswer; + } + + // 2 Sekunden warten, dann neue Frage + setTimeout(generateQuestion, 2000); +} \ No newline at end of file diff --git a/MainPage/ismail/style.css b/MainPage/ismail/style.css new file mode 100644 index 0000000..824b8ab --- /dev/null +++ b/MainPage/ismail/style.css @@ -0,0 +1,47 @@ +body { + font-family: Arial, sans-serif; + background-color: #f0f8ff; + text-align: center; + margin: 0; + padding: 0; +} + +.container { + margin-top: 50px; +} + +h1 { + color: #333; +} + +button { + padding: 10px 20px; + margin: 5px; + border: none; + border-radius: 8px; + background-color: #4CAF50; + color: white; + cursor: pointer; + font-size: 16px; +} + +button:hover { + background-color: #45a049; +} + +input { + padding: 10px; + font-size: 16px; + width: 150px; + margin-top: 10px; +} + +.question-box { + margin-top: 30px; +} + +.score { + margin-top: 20px; + font-size: 20px; + font-weight: bold; +} \ No newline at end of file