mirror of
https://gitlab.com/tutorial-java-rafa-munoz/tutorial-java-2024-25/LMSGI-2024-25.git
synced 2025-11-09 09:57:39 +01:00
35 lines
831 B
HTML
35 lines
831 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
<script>
|
|
let contador = 0;
|
|
|
|
function actualizarContador() {
|
|
document.getElementById("contador").innerText = contador;
|
|
}
|
|
|
|
function incrementar() {
|
|
contador++;
|
|
actualizarContador();
|
|
}
|
|
|
|
function decrementar() {
|
|
contador--;
|
|
actualizarContador();
|
|
}
|
|
|
|
function resetear() {
|
|
contador = 0;
|
|
actualizarContador();
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<h2>Contador: <span id="contador">0</span></h2>
|
|
<button onclick="incrementar()">Incrementar</button>
|
|
<button onclick="decrementar()">Decrementar</button>
|
|
<button onclick="resetear()">Resetear</button>
|
|
</body>
|
|
</html>
|