1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!-- saved from url=(0058)http://www.gchagnon.fr/cours/dhtml/exercices/exo6vide.html -->
<html lang="fr"><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Exercice sur getElementById</title>
<script type="text/javascript">
function mySelected(){
var txtNormal = document.getElementById("idFormulaire");
var output = document.getElementById("mytext");
name = txtNormal.value;
output.innerHTML = "<em>" + name +"<\/em>";
output.innerHTML += "c'est un jolie nom !!";
}
</script>
<body>
<form action="">
<fieldset>
<select id="idFormulaire" onchange="mySelected()">
<option id="entre" value="ENTRER">Entre</option>
<option id="mois" value="Mois">mois</option>
</select>
<div id="mytext">observer</div>
</fieldset>
</form>
</body>
</html> |
Partager