bonjour,
je n'arrive pas a afficher un div quand la page vient de s'ouvrir.... je suis obligé de cliqué sur une des options pour voir le formulaire, quand je force avec selected pareille, ça n'affiche pas le formulaire ...
il y a une méthode ou c'est impossible a faire.
voila la partis du code:
la partie html
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 function affiche_formulaire(){ var choix = document.Annonce.categorie.selectedIndex; document.getElementById('spanformorig').style.visibility = 'hidden'; document.getElementById('spanvehicule').style.visibility = 'hidden'; document.getElementById('location').style.visibility = 'hidden'; if (choix == 3 || choix == 4){ document.getElementById('spanvehicule').style.visibility = (choix==3)? 'visible' : 'hidden'; document.getElementById('location').style.visibility = (choix==4)? 'visible' : 'hidden'; } else { document.getElementById('spanformorig').style.visibility = 'visible'; }}
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
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 <select name="categorie" OnChange="affiche_formulaire();"> <option value="" >«Choisissez la catégorie»</option> <option value="" style="background-color:#dcdcc3" disabled="">-- VEHICULES --</option> <?php if ($categ == 1) { ?> <option value="1" id="cat1" selected>Automobiles</option> <?php }else{ ?> <option value="1" id="cat1" >Automobiles</option> <?php } if ($categ == 2) { ?> <option value="2" id="cat2" selected>Equipement Auto</option> <?php }else{ ?> <option value="2" id="cat2">Equipement Auto</option> <?php } </select>








Répondre avec citation
Partager