Pb affichage menu deroulant!!!

Résolu
joduak Messages postés 194 Date d'inscription lundi 11 juillet 2005 Statut Membre Dernière intervention 13 avril 2007 - 13 août 2005 à 17:17
joduak Messages postés 194 Date d'inscription lundi 11 juillet 2005 Statut Membre Dernière intervention 13 avril 2007 - 13 août 2005 à 17:55
Salut!


Pb de js, je n'arrive pas à afficher les différents éléments d'un menu déroulant à l'aide d'un tableau JS:





J'ai essayé pleins de trucs du style :

<select name="Nombre_voiture" size="1" id="nb_voiture">

<option selected="selected">... choisir</option>

<script language="JavaScript">

for(t=0;t"affichage_voiture[t]"</option>";

}

</script>



Merci à vous!

4 réponses

GhislainLavoie Messages postés 289 Date d'inscription vendredi 11 mars 2005 Statut Membre Dernière intervention 3 avril 2008 3
13 août 2005 à 17:28
Salut!


Essai comme ceci :


<html>
<head>
<title>Untitled</title>

<script type="text/javascript">
affichage_voiture
=
new Array
();
affichage_voiture
[0]=
"voiture 1";
affichage_voiture
[1]=
"voiture 2";
affichage_voiture
[2]=
"voiture 3";
affichage_voiture
[3]=
"voiture 4";

</script>
</head>

<select name=
"Nombre_voiture" size=
"1" id=
"nb_voiture">
<option selected=
"selected">... choisir</option>

<script language="JavaScript">

for(t
=0;t
'
+affichage_voiture
[t
]+'
</option
>'
);

}

</script>
</select>

</html>


A+, Ghislain
3
GhislainLavoie Messages postés 289 Date d'inscription vendredi 11 mars 2005 Statut Membre Dernière intervention 3 avril 2008 3
13 août 2005 à 17:42
Ou idéalement :


<html>
<head>
<title>Untitled</title>

<script type= "text/javascript">
affichage_voiture
=
new Array
();
affichage_voiture
[0]=
"voiture 1";
affichage_voiture
[1]=
"voiture 2";
affichage_voiture
[2]=
"voiture 3";
affichage_voiture
[3]=
"voiture 4";

function loadVoiture
()

{

var sel
= document
.getElementById
("Nombre_voiture");

var elOpt;

for(t
=0;t

</head>

<select name=
"Nombre_voiture" id=
"Nombre_voiture" size=
"1" id=
"nb_voiture">
<option selected=
"selected">... choisir</option>
</select>

</html>

A+, Ghislain
3
joduak Messages postés 194 Date d'inscription lundi 11 juillet 2005 Statut Membre Dernière intervention 13 avril 2007
13 août 2005 à 17:35
je te remercie beaucoup, tu déchires ghislain!
Bon week end à toi :)
0
joduak Messages postés 194 Date d'inscription lundi 11 juillet 2005 Statut Membre Dernière intervention 13 avril 2007
13 août 2005 à 17:55
Merci de me propsoer plusieurs solutions, ça me permet de progresser un peu en même temps!
Merci mille fois!
+
0
Rejoignez-nous