Récupérer un champs dans un autre
Salut, donc voila un script que j'ai trouvé bien pratique mais je dois le modifier pour pouvoir l'utiliser et je suis très nul en javascript (pas seulement qu'en javascript !), bref voila le script :
Code:
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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
| <script language="javascript">
function ajout(listeDep){
var existe = 0;
if(listeDep.options[listeDep.selectedIndex].value != 0){
for(i=1;i< document.getElementById('arrive').length ;i++){
if(document.getElementById('arrive').options[i].text ==
listeDep.options[listeDep.selectedIndex].text){
existe = 1;
}
else{
if(existe == 1){
existe = 1;
}
else{
existe = 0;
}
}
}
if(existe == 0){
var option = new Option(listeDep.options[listeDep.selectedIndex].
text,listeDep.options[listeDep.selectedIndex].value);
document.getElementById('arrive').options[0].text =
"-- Liste des clients séléctionnés --";
document.getElementById('arrive').options[0].value = 0;
document.getElementById('arrive').options[(document.
getElementById('arrive').length)] = option;
}
else{
alert('Cette option est déjà sélectionnée !!!');
}
}
}
function enleve(listeArr){
if(listeArr.options[listeArr.selectedIndex].value == 0){
}
else{
listeArr.options[listeArr.selectedIndex] = null;
}
}
</script>
<table width="90%">
<tr>
<td>
<select name="depart" size="5" ondblclick="ajout(this)"
style="scrollbar-3dlight-color:red; border: red 1px solid; background-color: #f2f2f2">
<option value="0">
Double clic pour sélectionner un client
</option>
<option value="1">Option1</option>
<option value="2">Option2</option>
<option value="3">Option3</option>
<option value="4">Option4</option>
</select>
</td>
<td>
<select name="depart0" size="5" ondblclick="ajout(this)"
style="scrollbar-3dlight-color:red; border: red 1px solid; background-color: #f2f2f2">
<option value="0">
Double clic pour sélectionner un client
</option>
<option value="1">Option5</option>
<option value="2">Option6</option>
<option value="3">Option7</option>
<option value="4">Option8</option>
</select>
</td>
<td>
</td>
</tr>
</table>
<p>
<select name="arrive" id="arrive" size="5" ondblclick="enleve(this);"
style="scrollbar-3dlight-color:red; border: red 1px solid; background-color: #f2f2f2">
<option value="0">
Aucune option n'est sélectionnée !!!
</option> |
l'objectif est de récupérer la liste dans un autre champs (un quatrième) sous forme de :
Option1 Option2 Option3 ...
Et cela pour lancer une recherche avec un autre script !
Merci