<!DOCTYPE html>
<html>
<head>
<title>Quiz Time!</title>
</head>
<body>
<h1>What is the capital of France?</h1>
<button id="parisBtn" onclick="checkAnswer('paris')">Paris</button>
<button id="londonBtn" onclick="checkAnswer('london')">London</button>
<button id="berlinBtn" onclick="checkAnswer('berlin')">Berlin</button>
<p id="result"></p>
<script>
function checkAnswer(answer) {
if(answer === 'paris') {
document.getElementById('result').innerText = "Correct! Paris is the capital of France.";
} else {
document.getElementById('result').innerText = "Incorrect. Please try again.";
}
}
</script>
</body>
</html>
write a HTML code:
Include at least one question.
Include at least three possible answers for your question.
Include a message that indicates whether the correct button was clicked.
1 answer