Hier is de HTML-code voor de quiz over de wet van Ohm. Deze code kan je kopiëren en plakken in Google Sites. De quiz heeft een aantrekkelijke lay-out voor jongeren en biedt feedback op elke vraag, zodat studenten kunnen leren uit hun fouten. Aan het einde van de quiz kunnen studenten hun score zien en de quiz opnieuw proberen.
html<!DOCTYPE html> <html lang="nl"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>De wet van Ohm</title> <style> body { font-family: Arial, sans-serif; background-color: #f0f8ff; color: #333; margin: 0; padding: 0; } .container { max-width: 800px; margin: auto; padding: 20px; background: #fff; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } h1 { text-align: center; color: #0066cc; } .question { margin-bottom: 20px; } .options { list-style-type: none; padding: 0; } .options li { margin-bottom: 10px; } .feedback { margin-top: 10px; display: none; } .feedback.correct { color: green; } .feedback.incorrect { color: red; } .score { text-align: center; margin-top: 20px; } .retry-button { display: block; width: 100%; max-width: 300px; margin: 20px auto; padding: 10px; background-color: #0066cc; color: #fff; text-align: center; text-decoration: none; border-radius: 5px; } </style> </head> <body> <div class="container"> <h1>De wet van Ohm</h1> <div id="quiz"></div> <div class="score" id="score"></div> <a href="#" class="retry-button" id="retry">Probeer opnieuw</a> </div> <script> const quizData = { "title": "De wet van Ohm", "questions": [ { "question": "Wat is de wet van Ohm?", "options": [ "De spanning is gelijk aan de stroomsterkte maal de weerstand.", "De stroomsterkte is gelijk aan de spanning gedeeld door de weerstand.", "De weerstand is gelijk aan de spanning maal de stroomsterkte.", "Geen van de bovenstaande." ], "correct_answer": 1, "feedback": { "0": "Dat is niet correct. De wet van Ohm zegt dat V = IR, dus de stroomsterkte I is gelijk aan de spanning V gedeeld door de weerstand R.", "1": "Goed zo! De wet van Ohm zegt dat V = IR, dus de stroomsterkte I is gelijk aan de spanning V gedeeld door de weerstand R.", "2": "Dat is niet correct. De wet van Ohm zegt dat V = IR, dus de stroomsterkte I is gelijk aan de spanning V gedeeld door de weerstand R.", "3": "Dat is niet correct. De wet van Ohm zegt dat V = IR, dus de stroomsterkte I is gelijk aan de spanning V gedeeld door de weerstand R." } }, { "question": "Welke formule gebruik je om de stroomsterkte te berekenen?", "options": [ "I = VR", "I = V/R", "I = R/V", "I = V + R" ], "correct_answer": 1, "feedback": { "0": "Dat is niet correct. De juiste formule is I = V/R.", "1": "Goed zo! De juiste formule is I = V/R.", "2": "Dat is niet correct. De juiste formule is I = V/R.", "3": "Dat is niet correct. De juiste formule is I = V/R." } }, { "question": "Wat gebeurt er met de stroomsterkte als de weerstand toeneemt (met een constante spanning)?", "options": [ "De stroomsterkte neemt toe.", "De stroomsterkte neemt af.", "De stroomsterkte blijft hetzelfde.", "De stroomsterkte fluctueert." ], "correct_answer": 1, "feedback": { "0": "Dat is niet correct. Volgens de wet van Ohm neemt de stroomsterkte af als de weerstand toeneemt bij een constante spanning.", "1": "Goed zo! Volgens de wet van Ohm neemt de stroomsterkte af als de weerstand toeneemt bij een constante spanning.", "2": "Dat is niet correct. Volgens de wet van Ohm neemt de stroomsterkte af als de weerstand toeneemt bij een constante spanning.", "3": "Dat is niet correct. Volgens de wet van Ohm neemt de stroomsterkte af als de weerstand toeneemt bij een constante spanning." } }, { "question": "Welke eenheid heeft de elektrische weerstand?", "options": [ "Ampère", "Volt", "Ohm", "Watt" ], "correct_answer": 2, "feedback": { "0": "Dat is niet correct. De eenheid van elektrische weerstand is Ohm.", "1": "Dat is niet correct. De eenheid van elektrische weerstand is Ohm.", "2": "Goed zo! De eenheid van elektrische weerstand is Ohm.", "3": "Dat is niet correct. De eenheid van elektrische weerstand is Ohm." } }, { "question": "Wat is de formule voor de spanning (V) volgens de wet van Ohm?", "options": [ "V = IR", "V = I/R", "V = R/I", "V = I + R" ], "correct_answer": 0, "feedback": { "0": "Goed zo! De juiste formule is V = IR.", "1": "Dat is niet correct. De juiste formule is V = IR.", "2": "Dat is niet correct. De juiste formule is V = IR.", "3": "Dat is niet correct. De juiste formule is V = IR." } } ] }; let currentQuestion = 0; let score = 0; function loadQuestion() { const question = quizData.questions[currentQuestion]; let optionsHtml = question.options.map((option, index) => `<li><label><input type="radio" name="option" value="${index}"> ${option}</label></li>` ).join(''); document.getElementById('quiz').innerHTML = ` <div class="question"> <h2>Vraag ${currentQuestion + 1}: ${question.question}</h2> <ul class="options">${optionsHtml}</ul> <div class="feedback" id="feedback"></div> <button onclick="submitAnswer()">Verzenden</button> </div> `; } function submitAnswer() { const selectedOption = document.querySelector('input[name="option"]:checked'); if (!selectedOption) return; const question = quizData.questions[currentQuestion]; const feedbackElement = document.getElementById('feedback'); if (parseInt(selectedOption.value) === question.correct_answer) { score++; feedbackElement.className = 'feedback correct'; } else { feedbackElement.className = 'feedback incorrect'; } feedbackElement.innerHTML = question.feedback[selectedOption.value]; feedbackElement.style.display = 'block'; setTimeout(() => { feedbackElement.style.display = 'none'; currentQuestion++; if (currentQuestion < quizData.questions.length) { loadQuestion(); } else { showScore(); } }, 2000); } function showScore() { document.getElementById('quiz').innerHTML = ''; document.getElementById('score').innerHTML = `Je hebt ${score} van de ${quizData.questions.length} vragen correct beantwoord.`; document.getElementById('retry').style.display = 'block'; } document.getElementById('retry').onclick = function() { currentQuestion = 0; score = 0; document.getElementById('score').innerHTML = ''; document.getElementById('retry').style.display = 'none'; loadQuestion(); return false; }; loadQuestion(); </script> </body> </html>
Je kunt deze code kopiëren en plakken in een HTML-component op je Google Site. De quiz zal automatisch de vragen laden, feedback geven op elk antwoord, en de studenten de mogelijkheid bieden om de quiz opnieuw te proberen.
Ik heb de HTML-code aangepast om het symbool voor spanning te veranderen van V naar U. Hier is de bijgewerkte code:
html<!DOCTYPE html> <html lang="nl"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>De wet van Ohm</title> <style> body { font-family: Arial, sans-serif; background-color: #f0f8ff; color: #333; margin: 0; padding: 0; } .container { max-width: 800px; margin: auto; padding: 20px; background: #fff; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } h1 { text-align: center; color: #0066cc; } .question { margin-bottom: 20px; } .options { list-style-type: none; padding: 0; } .options li { margin-bottom: 10px; } .feedback { margin-top: 10px; display: none; } .feedback.correct { color: green; } .feedback.incorrect { color: red; } .score { text-align: center; margin-top: 20px; } .retry-button { display: block; width: 100%; max-width: 300px; margin: 20px auto; padding: 10px; background-color: #0066cc; color: #fff; text-align: center; text-decoration: none; border-radius: 5px; } </style> </head> <body> <div class="container"> <h1>De wet van Ohm</h1> <div id="quiz"></div> <div class="score" id="score"></div> <a href="#" class="retry-button" id="retry">Probeer opnieuw</a> </div> <script> const quizData = { "title": "De wet van Ohm", "questions": [ { "question": "Wat is de wet van Ohm?", "options": [ "De spanning is gelijk aan de stroomsterkte maal de weerstand.", "De stroomsterkte is gelijk aan de spanning gedeeld door de weerstand.", "De weerstand is gelijk aan de spanning maal de stroomsterkte.", "Geen van de bovenstaande." ], "correct_answer": 1, "feedback": { "0": "Dat is niet correct. De wet van Ohm zegt dat U = IR, dus de stroomsterkte I is gelijk aan de spanning U gedeeld door de weerstand R.", "1": "Goed zo! De wet van Ohm zegt dat U = IR, dus de stroomsterkte I is gelijk aan de spanning U gedeeld door de weerstand R.", "2": "Dat is niet correct. De wet van Ohm zegt dat U = IR, dus de stroomsterkte I is gelijk aan de spanning U gedeeld door de weerstand R.", "3": "Dat is niet correct. De wet van Ohm zegt dat U = IR, dus de stroomsterkte I is gelijk aan de spanning U gedeeld door de weerstand R." } }, { "question": "Welke formule gebruik je om de stroomsterkte te berekenen?", "options": [ "I = UR", "I = U/R", "I = R/U", "I = U + R" ], "correct_answer": 1, "feedback": { "0": "Dat is niet correct. De juiste formule is I = U/R.", "1": "Goed zo! De juiste formule is I = U/R.", "2": "Dat is niet correct. De juiste formule is I = U/R.", "3": "Dat is niet correct. De juiste formule is I = U/R." } }, { "question": "Wat gebeurt er met de stroomsterkte als de weerstand toeneemt (met een constante spanning)?", "options": [ "De stroomsterkte neemt toe.", "De stroomsterkte neemt af.", "De stroomsterkte blijft hetzelfde.", "De stroomsterkte fluctueert." ], "correct_answer": 1, "feedback": { "0": "Dat is niet correct. Volgens de wet van Ohm neemt de stroomsterkte af als de weerstand toeneemt bij een constante spanning.", "1": "Goed zo! Volgens de wet van Ohm neemt de stroomsterkte af als de weerstand toeneemt bij een constante spanning.", "2": "Dat is niet correct. Volgens de wet van Ohm neemt de stroomsterkte af als de weerstand toeneemt bij een constante spanning.", "3": "Dat is niet correct. Volgens de wet van Ohm neemt de stroomsterkte af als de weerstand toeneemt bij een constante spanning." } }, { "question": "Welke eenheid heeft de elektrische weerstand?", "options": [ "Ampère", "Volt", "Ohm", "Watt" ], "correct_answer": 2, "feedback": { "0": "Dat is niet correct. De eenheid van elektrische weerstand is Ohm.", "1": "Dat is niet correct. De eenheid van elektrische weerstand is Ohm.", "2": "Goed zo! De eenheid van elektrische weerstand is Ohm.", "3": "Dat is niet correct. De eenheid van elektrische weerstand is Ohm." } }, { "question": "Wat is de formule voor de spanning (U) volgens de wet van Ohm?", "options": [ "U = IR", "U = I/R", "U = R/I", "U = I + R" ], "correct_answer": 0, "feedback": { "0": "Goed zo! De juiste formule is U = IR.", "1": "Dat is niet correct. De juiste formule is U = IR.", "2": "Dat is niet correct. De juiste formule is U = IR.", "3": "Dat is niet correct. De juiste formule is U = IR." } } ] }; let currentQuestion = 0; let score = 0; function loadQuestion() { const question = quizData.questions[currentQuestion]; let optionsHtml = question.options.map((option, index) => `<li><label><input type="radio" name="option" value="${index}"> ${option}</label></li>` ).join(''); document.getElementById('quiz').innerHTML = ` <div class="question"> <h2>Vraag ${currentQuestion + 1}: ${question.question}</h2> <ul class="options">${optionsHtml}</ul> <div class="feedback" id="feedback"></div> <button onclick="submitAnswer()">Verzenden</button> </div> `; } function submitAnswer() { const selectedOption = document.querySelector('input[name="option"]:checked'); if (!selectedOption) return; const question = quizData.questions[currentQuestion]; const feedbackElement = document.getElementById('feedback'); if (parseInt(selectedOption.value) === question.correct_answer) { score++; feedbackElement.className = 'feedback correct'; } else { feedbackElement.className = 'feedback incorrect'; } feedbackElement.innerHTML = question.feedback[selectedOption.value]; feedbackElement.style.display = 'block'; setTimeout(() => { feedbackElement.style.display = 'none'; currentQuestion++; if (currentQuestion < quizData.questions.length) { loadQuestion(); } else { showScore(); } }, 2000); } function showScore() { document.getElementById('quiz').innerHTML = ''; document.getElementById('score').innerHTML = `Je hebt ${score} van de ${quizData.questions.length} vragen correct beantwoord.`; document.getElementById('retry').style.display = 'block'; } document.getElementById('retry').onclick = function() { currentQuestion = 0; score = 0; document.getElementById('score').innerHTML = ''; document.getElementById('retry').style.display = 'none'; loadQuestion(); return false; }; loadQuestion(); </script> </body> </html>
Deze code gebruikt nu U als symbool voor spanning. Je kunt deze code kopiëren en plakken in je Google Site.
Ik heb de HTML-code aangepast om ervoor te zorgen dat er een punt (.) tussen de factoren van een vermenigvuldiging staat en om een knop toe te voegen waarmee leerlingen naar de volgende vraag kunnen gaan nadat ze de feedback hebben gelezen. Hier is de bijgewerkte code:
html<!DOCTYPE html> <html lang="nl"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>De wet van Ohm</title> <style> body { font-family: Arial, sans-serif; background-color: #f0f8ff; color: #333; margin: 0; padding: 0; } .container { max-width: 800px; margin: auto; padding: 20px; background: #fff; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } h1 { text-align: center; color: #0066cc; } .question { margin-bottom: 20px; } .options { list-style-type: none; padding: 0; } .options li { margin-bottom: 10px; } .feedback { margin-top: 10px; display: none; } .feedback.correct { color: green; } .feedback.incorrect { color: red; } .score { text-align: center; margin-top: 20px; } .retry-button, .next-button { display: block; width: 100%; max-width: 300px; margin: 20px auto; padding: 10px; background-color: #0066cc; color: #fff; text-align: center; text-decoration: none; border-radius: 5px; } </style> </head> <body> <div class="container"> <h1>De wet van Ohm</h1> <div id="quiz"></div> <div class="score" id="score"></div> <a href="#" class="retry-button" id="retry">Probeer opnieuw</a> <a href="#" class="next-button" id="next" style="display: none;">Volgende</a> </div> <script> const quizData = { "title": "De wet van Ohm", "questions": [ { "question": "Wat is de wet van Ohm?", "options": [ "De spanning is gelijk aan de stroomsterkte maal de weerstand.", "De stroomsterkte is gelijk aan de spanning gedeeld door de weerstand.", "De weerstand is gelijk aan de spanning maal de stroomsterkte.", "Geen van de bovenstaande." ], "correct_answer": 1, "feedback": { "0": "Dat is niet correct. De wet van Ohm zegt dat U = I.R, dus de stroomsterkte I is gelijk aan de spanning U gedeeld door de weerstand R.", "1": "Goed zo! De wet van Ohm zegt dat U = I.R, dus de stroomsterkte I is gelijk aan de spanning U gedeeld door de weerstand R.", "2": "Dat is niet correct. De wet van Ohm zegt dat U = I.R, dus de stroomsterkte I is gelijk aan de spanning U gedeeld door de weerstand R.", "3": "Dat is niet correct. De wet van Ohm zegt dat U = I.R, dus de stroomsterkte I is gelijk aan de spanning U gedeeld door de weerstand R." } }, { "question": "Welke formule gebruik je om de stroomsterkte te berekenen?", "options": [ "I = U.R", "I = U/R", "I = R/U", "I = U + R" ], "correct_answer": 1, "feedback": { "0": "Dat is niet correct. De juiste formule is I = U/R.", "1": "Goed zo! De juiste formule is I = U/R.", "2": "Dat is niet correct. De juiste formule is I = U/R.", "3": "Dat is niet correct. De juiste formule is I = U/R." } }, { "question": "Wat gebeurt er met de stroomsterkte als de weerstand toeneemt (met een constante spanning)?", "options": [ "De stroomsterkte neemt toe.", "De stroomsterkte neemt af.", "De stroomsterkte blijft hetzelfde.", "De stroomsterkte fluctueert." ], "correct_answer": 1, "feedback": { "0": "Dat is niet correct. Volgens de wet van Ohm neemt de stroomsterkte af als de weerstand toeneemt bij een constante spanning.", "1": "Goed zo! Volgens de wet van Ohm neemt de stroomsterkte af als de weerstand toeneemt bij een constante spanning.", "2": "Dat is niet correct. Volgens de wet van Ohm neemt de stroomsterkte af als de weerstand toeneemt bij een constante spanning.", "3": "Dat is niet correct. Volgens de wet van Ohm neemt de stroomsterkte af als de weerstand toeneemt bij een constante spanning." } }, { "question": "Welke eenheid heeft de elektrische weerstand?", "options": [ "Ampère", "Volt", "Ohm", "Watt" ], "correct_answer": 2, "feedback": { "0": "Dat is niet correct. De eenheid van elektrische weerstand is Ohm.", "1": "Dat is niet correct. De eenheid van elektrische weerstand is Ohm.", "2": "Goed zo! De eenheid van elektrische weerstand is Ohm.", "3": "Dat is niet correct. De eenheid van elektrische weerstand is Ohm." } }, { "question": "Wat is de formule voor de spanning (U) volgens de wet van Ohm?", "options": [ "U = I.R", "U = I/R", "U = R/I", "U = I + R" ], "correct_answer": 0, "feedback": { "0": "Goed zo! De juiste formule is U = I.R.", "1": "Dat is niet correct. De juiste formule is U = I.R.", "2": "Dat is niet correct. De juiste formule is U = I.R.", "3": "Dat is niet correct. De juiste formule is U = I.R." } } ] }; let currentQuestion = 0; let score = 0; function loadQuestion() { const question = quizData.questions[currentQuestion]; let optionsHtml = question.options.map((option, index) => `<li><label><input type="radio" name="option" value="${index}"> ${option}</label></li>` ).join(''); document.getElementById('quiz').innerHTML = ` <div class="question"> <h2>Vraag ${currentQuestion + 1}: ${question.question}</h2> <ul class="options">${optionsHtml}</ul> <div class="feedback" id="feedback"></div> <button onclick="submitAnswer()">Verzenden</button> </div> `; document.getElementById('next').style.display = 'none'; } function submitAnswer() { const selectedOption = document.querySelector('input[name="option"]:checked'); if (!selectedOption) return; const question = quizData.questions[currentQuestion]; const feedbackElement = document.getElementById('feedback'); if (parseInt(selectedOption.value) === question.correct_answer) { score++; feedbackElement.className = 'feedback correct'; } else { feedbackElement.className = 'feedback incorrect'; } feedbackElement.innerHTML = question.feedback[selectedOption.value]; feedbackElement.style.display = 'block'; document.getElementById('next').style.display = 'block'; } function nextQuestion() { const feedbackElement = document.getElementById('feedback'); feedbackElement.style.display = 'none'; currentQuestion++; if (currentQuestion < quizData.questions.length) { loadQuestion(); } else { showScore(); } } function showScore() { document.getElementById('quiz').innerHTML = ''; document.getElementById('score').innerHTML = `Je hebt ${score} van de ${quizData.questions.length} vragen correct beantwoord.`; document.getElementById('retry').style.display = 'block'; document.getElementById('next').style.display = 'none'; } document.getElementById('retry').onclick = function() { currentQuestion = 0; score = 0; document.getElementById('score').innerHTML = ''; document.getElementById('retry').style.display = 'none'; loadQuestion(); return false; }; document.getElementById('next').onclick = function() { nextQuestion(); return false; }; loadQuestion(); </script> </body> </html>
In deze versie is er een punt toegevoegd tussen de factoren in de vermenigvuldigingen en is er een "Volgende" knop toegevoegd die verschijnt nadat een leerling een antwoord heeft ingediend. Deze knop laat de leerling doorgaan naar de volgende vraag.
Le Chat can make mistakes. Check answers. Learn more