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>
Partager