mirror of
https://gitlab.com/tutorial-java-rafa-munoz/tutorial-java-2024-25/LMSGI-2024-25.git
synced 2025-11-09 18:03:06 +01:00
25 lines
821 B
HTML
25 lines
821 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
<script>
|
|
function mostrarValor() {
|
|
let input = document.getElementById("numero");
|
|
let valor = parseInt(input.value);
|
|
let parrafo = document.getElementById("resultado");
|
|
|
|
if (valor === 0) {
|
|
parrafo.style.display = "none"; // Oculta el <p> si el valor es 0
|
|
} else {
|
|
parrafo.style.display = "block"; // Asegura que se muestre si no es 0
|
|
parrafo.innerText = "Valor ingresado: " + valor;
|
|
}
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<input type="number" id="numero" placeholder="Ingresa un número" onblur="mostrarValor()">
|
|
<p id="resultado" style="display: none;"></p>
|
|
</body>
|
|
</html>
|