affichage d'un champs text en javascript
bonjour a tous,
j'ai un menu deroulant avec 6 possibilités (CDI, CDD, INTERIM, STAGE, PROFESSIONNALISATION, APPRENTISSAGE)
quand je choisi les deux premiers, j'arrive a afficher les modalités mais quand je choisi les 4 derniers j'aimerais afficher un champs text (genre --> Durée du contrat : _________)
je n'arrive pas a afficher ce champs text, voici le code du menu déroulant :
dans le head :
Code:
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
| <script type='text/javascript'>
function showChoice(lechoix){
var affiche ="";
switch(lechoix){
case ('a') : affiche="123";
break;
case ('b') : affiche="24";
break;
case ('c') : affiche="";
break;
case ('d') : affiche="";
break;
case ('e') : affiche="";
break;
case ('f') : affiche="";
break;
}
var listesouschoix=document.getElementsByName('souschoix');
for(i=0;i<listesouschoix.length;i++){
var here =(affiche.indexOf(i)>-1)?'':'none';
listesouschoix[i].style.display= here;
document.getElementById("label"+(i*1+1)).style.display=here;
}
}
</script> |
dans le body :
Code:
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
| <?php
echo "
<select name='choix' id='choix' onchange='showChoice(this.value)'>
<option selected>-----------Sélectionnez-----------</option>
<option value='a'>CDI</option>
<option value='b'>CDD</option>
<option value='c'>INTERIM</option>
<option value='d'>STAGE</option>
<option value='e'>PROFESSIONNALISATION</option>
<option value='f'>APPRENTISSAGE</option>
</select><br>
<input type='radio' name='souschoix' id='souschoix1' style='display:none;' value='machin chose 1' /><label for='souschoix1'
id='label1' style='display:none;' >sous choix 1</label>
<input type='radio' name='souschoix' id='souschoix2' style='display:none;' value='machin chose 2' /><label for='souschoix2'
id='label2' style='display:none;' >Remplacement</label>
<input type='radio' name='souschoix' id='souschoix3' style='display:none;' value='machin chose 3' /><label for='souschoix3'
id='label3' style='display:none;' >Création</label>
<input type='radio' name='souschoix' id='souschoix4' style='display:none;' value='machin chose 4' /><label for='souschoix4'
id='label4' style='display:none;' >Transformation d'un CDD</label>
<input type='radio' name='souschoix' id='souschoix5' style='display:none;' value='machin chose 5' /><label for='souschoix5'
id='label5' style='display:none;' >Renouvellement</label><br> " ;
?> |
est ce que quelqu'un pourrait-il m'aider
merci d'avance
salutations.