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 28 29 30 31 32 33 34 35
|
<form name "test">
<select name "select1 onChange "changeDonnees(this)">
<option value "1"> 1</option/
<option value "2">2</option>
</select>
<select name"select2" onChange "changeDonnees(this)">>
<option value "1"> 1</option>
<option value "2">2</opton>
</select>
<select name "selectA>
<option> 1</option/
</select>
<select name"selectB">
<option></opton>
</select>
<script type="text/javascript">
function changeDonnees(voila){
var tab1 =["allo", "merci"] //c juste un exemple mes tab contiennent de longues listes
var tab2 =["bonjour", bonsoir"]
var Choisi = (voila.options[voila.selectedIndex].value);
var i, listeDonnees;
if (Choisi ==1){
tableau = tab1;
listeDonnees = document.test.selectA;
}
else if (choisi == 2){
tableau = tab2;
listeDonnees = document.test.selectB;
}
for(i in tableau){
listeDonnees.options[i] = new Option(tableau[i]);
} |
Partager