Last active
May 17, 2022 08:49
-
-
Save Fhernd/100963165acf1b3d995e5e9439d692ac to your computer and use it in GitHub Desktop.
// Ejercicio 288: Uso del evento onchange sobre el elemento select de HTML.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Ejercicio 288: Uso del evento onchange sobre el elemento select de HTML. | |
function seleccionarLenguaje(){ | |
let cbxLenguajes = document.getElementById('cbxLenguajes'); | |
let lenguaje = cbxLenguajes.value; | |
document.getElementById('lblLenguajeSeleccionado').innerText = `Ud. ha seleccionado el lenguaje ${lenguaje}.`; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>JavaScript - Ejercicio 288</title> | |
</head> | |
<body> | |
<h1>JavaScript - Ejercicio 288</h1> | |
<span>Seleccione su lenguaje favorito:</span><br> | |
<select id="cbxLenguajes" onchange="seleccionarLenguaje();"> | |
<option value="JavaScript">JavaScript</option> | |
<option value="C#">C#</option> | |
<option value="Java">Java</option> | |
<option value="PHP">PHP</option> | |
<option value="Python">Python</option> | |
</select> | |
<br> | |
<span id="lblLenguajeSeleccionado"></span> | |
<script src="ex288_evento_onchange_select.js"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment