

new!








|
[ Forums >> Webmasters >> Général >> liste déroulante ]
| > liste déroulante |
[ Posté par DCO ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 28-02-2008 à 12:35 | 11 messages ]
  |
 Bonjour,
Je viens ici poser une question car après avoir parcourus le forum je ne sait plus où j'en suis et comment faire.
J'explique:
J'ai un formulaire de recherche dans lequel j'ai inséré 3 listes déroulantes avec un bouton radio qui lui est associé et je voudrai que lors d'un click sur un bouton radio la liste déroulante s'affiche à l'écran et si l'on en choisie une autre celle affiché s'efface et sois remplacé par celle selectionnée etc... Mais à l'ouverture du formulaire aucun bouton radion doit être activé, et en plus j'aimerai bien que lors d'un click dans la liste déroulante l'option choisie s'affiche dans le champs texte.
Je vous donne mon code:
<html>
<head>
<title>Rechercher</title>
<link href="/enreg_form/css/style2.css" rel="stylesheet" type="text/css">
</head>
<body>
<form action='/enreg_form/scripts/recherche.php' target="rechbas" method='post' name="rechercher" enctype="multipart/form-data">
<table width="100%" border="0" align="center" height="41">
<tr>
<td width="21%" height="19">
<div align="center">Trier par</div>
</td>
<td width="9%" height="19">
<input type="radio" name="choix" value="nom">
Nom </td>
<td width="15%" height="19">
<input type="radio" name="choix" value="codepostal">
Code Postal</td>
<td colspan="2" height="19">
<input type="radio" name="choix" value="ville">
Ville</td>
<td width="8%" height="19"> </td>
<td width="1%" height="19"> </td>
<td width="20%" height="19"> </td>
</tr>
<tr>
<td width="21%"> </td>
<td colspan="4">
<div align="center">
<input class='text' type="text" name="recherche" size=50 maxlength=50>
</div>
</td>
<td width="8%">
<input type="submit" name="Rechercher" value="Rechercher">
</td>
<td width="1%"> </td>
<td width="20%">
<div align="right">
<input type="reset" name="retablir" value="Effacer">
</div>
</td>
</tr>
</table>
<table width=100% align=center>
<tr>
<td width="20%">
<div align="center"> ou trier par</div>
</td>
<td width="12%">
<input type="radio" name="choix" value="civilite">Civilité</td>
<td width="12%">
<input type="radio" name="choix" value="type">
Statut </td>
<td width="9%">
<input type="radio" name="choix" value="date">
Date </td>
<td width="14%">
<select name="civilite">
<option selected value="">
<option value="Monsieur">Monsieur
<option value="Madame">Madame
<option value="Mademoiselle">Mademoiselle
</select>
</td>
<td width="9%">
<select name="type">
<option selected value="">
<option value="Ancien">Ancien
<option value="Nouveau">Nouveau
<option value="Autre">Autre
</select>
</td>
<td width="24%">
<select name="date">
<option selected value="">
<option value="15 mars 2008">15 mars 2008
<option value="07 et 21 juin 2008">07 et 21 juin 2008
<option value="30 août 2008">30 août 2008
</select>
</td>
</tr>
</table>
<hr>
</form>
</body>
</html> |
|
Pouvez vous m'aider à faire cela car je suis complètement perdu dans tous ces codes.
D'avance merci.
________________ dco
  |

|
|
|
[ Posté par DCO ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 29-02-2008 à 09:10 | 11 messages ]
  Bonjour,
Il n'y a personne pour m'aider?
________________ dco
| [ Posté par v1nce ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 29-02-2008 à 12:34 | 3864 messages ]
 
<html>
<head>
<script>
function majradio(item)
{
// on boucle sur tous les select et on les masque
for (var i=1;i<=2;i++)
document.getElementById("s"+i).style.display ='none';
// on rend visible celui correpondant au checkbox
document.getElementById(item.value).style.display ='block';
}
</script>
</head>
<body>
<form>
<select id="s1" style="display:none" >
<option>toto s1</option>
</select>
<select id="s2" style="display:none">
<option>toto s2</option>
</select>
...<br />
s1<input type="radio" name="choix" value="s1" onclick="majradio(this)"><br/>
s2<input type="radio" name="choix" value="s2" onclick="majradio(this)"><br>
<input type="text" id="reponse">
</form>
</body>
</html> |
|
________________ V1nce
Si je les ai oubliés les bonjour, merci et au revoir sont implicites
Brevets logiciels : dites NON !
http://petition.eurolinux.org/index.html
http://swpat.ffii.org/index.fr.html
| [ Posté par DCO ] [ Détails ] [ Contact ] [ Citer ]
[ Posté le 29-02-2008 à 15:57 | 11 messages ]
  Bonjour et merci pour cette solution qui fonction bien, maintenant lorsque je clique sur un bouton radio j'ai le select voulu qui s'affiche.
Mais j'aurai aussi voulu que lorsque je sélectionne avec le click, dans la liste déroule apparue, une des valeurs elle se recopie automatiquement dans la zone texte.
Merci encore de votre aide et de votre patience.
________________ dco
|
|
Services email :
  Vous devez vous identifier pour profiter des services par email du forum.
|

|