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
|
<script>
function desactiverInput() {
if(document.form.choixAnimalSelect.value=='0')
{
document.form.choixAnimalText.disabled=false;
}
else
{
document.form.choixAnimalText.disabled=true;
document.form.choixAnimalText.value='';
}
}
function desactiverSelect() {
if(document.form.choixAnimalText.value!='')
{
document.form.choixAnimalSelect.disabled=true;
document.form.choixAnimalSelect.value=0;
}
else
{
document.form.choixAnimalSelect.disabled=false;
}
}
</script>
<form method="post" name="form" action="verif.php">
<select name="choixAnimalSelect" onchange="desactiverInput()">
<option value="0">Choisir</option>
<option value="1">Le chat</option>
<option value="2">Le chien</option>
<option value="3">L'oiseau</option>
</select>
--- ou ---
<input type="text" name="choixAnimalText" id="choixAnimalText" onkeyup="desactiverSelect()" />
<input type="submit" name="go" value="go">
</form> |