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 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
| <script language="javascript">
function listeElements() {
var result ="";
var sel = document.getElementById("arrive");
for (var i=0; i<sel.options.length;i++) {
result += " " + sel.options[i].text;
}
document.getElementById("x").value=result;
}
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;
listeElements();
}
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;
}
listeElements();
}
</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>
</select>
<input name="x" type="text" value="y"> |
Partager