Bonjour
J 'ai un souci de fonction javascript que je n arrive pas a faire. J ai 2 listbox et je voudrais que quand l'utilisateur a d�j� selectionn� des elements dans ces listes, qu'il puisse gr�ce � un bouton, enlever toutes ces s�lections.
j ai donc cr�er ce bouton sur lequel j ai affect� une fonction.
Mais voila j ai test� toutes les m�thodes possibles et imaginables que j ai trouv� sur les forums et il n y a rien qui marche :
quelqu'un aurait il une brillante id�e?? merci!!
Code : S�lectionner tout - Visualiser dans une fen�tre � part
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 function deselect(){ var listBox = document.getElementById('mod_perso'); var listOk = listBox.selectedIndex > -1; var listBox2 = document.getElementById('mod_commun'); var listOk2 = listBox2.selectedIndex > -1; var i; var j; /*listBox2.SelectedItems.Clear(); listBox.SelectedItems.Clear(); --------------- /*if ((listOk) && (listOk2)) { listBox.selected = false; listBox2.selected = false; } ------------ for i=0 to listBox.SelectedItems listBox.selected(i) = false; next i; for j=0 to listBox2.SelectedItems listBox2.selected(j) = false; next j; ----------- /*var nb = listBox.options.lenght; for (var i=0; i < nb; i++){ listBox.options.remove(i); } var nb = listBox2.options.lenght; for (var i=0; i < nb; i++){ listBox2.options.remove(i); } --------- /*{while (listBox.options[0]) { listBox.removeChild(listBox.options[0];} }*/ }
Partager