feat(ch 5): JS second block solved & accesoGenders.html

This commit is contained in:
Rafa Muñoz
2025-03-17 16:29:45 +01:00
parent 63fecbac6a
commit a1fd008a8e
8 changed files with 188 additions and 8 deletions

View File

@@ -5,11 +5,14 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <!-- el charset iso-8859-1 significa "español" -->
<script>
// Crea un formulario con un input y un botón. Al hacer clic, muestra el nombre y edad ingresados en un div.
// Crea un formulario con un input y un botón.
// Al hacer clic, muestra el nombre y edad ingresados
// en un div.
function mostrarMensaje() {
let nombre = document.getElementById("nombre").value;
let edad = document.getElementById("edad").value;
document.getElementById("resultado").innerHTML = 'Hola, ' + nombre + '. Tienes ' + edad + ' años.';
document.getElementById("resultado").innerHTML =
'Hola, ' + nombre + '. Tienes ' + edad + ' años.';
}
</script>