Professional Documents
Culture Documents
Evidencia
Evidencia
Evidencia
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Juego de Matemáticas</title>
</head>
<body>
<div class="container">
<h1>Juego de Matemáticas</h1>
<button onclick="checkAnswer()">Verificar</button>
<p id="result"></p>
</div>
<script src="script.js"></script>
</body>
</html>
Css:
body {
background-color: #f4f4f4;
margin: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
.container {
text-align: center;
background-color: #fff;
padding: 20px;
border-radius: 8px;
button {
padding: 10px;
margin-top: 10px;
cursor: pointer;
#result {
font-weight: bold;
color: green;
JS:
document.addEventListener('DOMContentLoaded', function () {
generateQuestion();
});
function generateQuestion() {
document.getElementById('num1').innerText = num1;
document.getElementById('num2').innerText = num2;
document.getElementById('answer').value = '';
document.getElementById('result').innerText = '';
function checkAnswer() {
document.getElementById('result').innerText = '¡Correcto!';
document.getElementById('result').style.color = 'green';
} else {
document.getElementById('result').style.color = 'red';