| [Javascript] basculement entre 2 listes par chouxe |
dimanche 16 avril 2006 à 20:10:00 |
function Deplacer(l1,l2) {
if (l1.options.selectedIndex>=0) {
o=new Option(l1.options[l1.options.selectedIndex].text,
l1.options[l1.options.selectedIndex].value);
l2.options[l2.options.length]=o;
}else{
alert("Aucune activité sélectionnée");
}
}
<html>
<head>
<script>
var selOptions = new Array();
function swap(listFrom, listTo){
fromList=document.getElementsByName(listFrom)[0];
toList = document.getElementsByName(listTo)[0];
while (fromList.selectedIndex != -1){
addOption(toList,fromList.options[fromList.selectedIndex]);
fromList.options.remove(fromList.selectedIndex);
}
}
function addOption(list, option){
list.options[list.options.length]=new Option(option.innerHTML,option.value);
}
</script>
</head>
<body>
<table>
<tr>
<td rowspan="2">
<select name="listA" id="listA" multiple="true">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
<option value="D">D</option>
</select>
</td>
<td>
<button onclick="swap('listA','listB');">></button>
</td>
<td rowspan="2">
<select name="listB" id="listB" multiple="true">
<option value="E">E</option>
<option value="F">F</option>
<option value="G">G</option>
<option value="H">H</option>
</select>
</td>
</tr>
<tr>
<td>
<button onclick="swap('listB','listA');"><</button>
</td>
</tr>
</table>
</body>
<html>
;-) HackTrack
|
| 24/08 17h46 | Lien avec 2 listes déroulantes: Javascript | Windows | 05/03 17h33 | 3 |
| 16/06 13h26 | Lien entre 2 listes déroulantes sur excel | Bureautique | 18/06 15h09 | 4 |
| 02/06 15h04 | [Outlook 2003] Fusionner 2 listes de distrib. | Logiciels/Pilotes | 02/06 16h55 | 2 |
| 27/05 08h57 | Javascript, entre 2 'function' | Programmation | 27/05 09h32 | 3 |
![]() | SuperCopier 2 - SuperCopier est un gestionnaire de copie de fichiers libre pour Windows, proposant des fonctionnalités non couvertes par le... | Catégorie: Gestion de fichiers Licence: Freeware/gratuit |
![]() | Visual Basic Express 2005 - Le langage de programmation Visual Basic est historiquement dans les gènes de la société Microsoft. Avec plus de 30.000... | Catégorie: Visual Basic Licence: Freeware/gratuit |
![]() | Foobar 2000 - Foobar2000 est un lecteur audio avancé pour les plateformes Microsoft Windows. Son interface graphique est volontairement... | Catégorie: Lecteurs audio Licence: Freeware/gratuit |
![]() | PowerArchiver 2001 - Power Archiver est un équivalent gratuit de WinZip avec des fonctionnalités en plus, avec une version en français !! | Catégorie: Compression/Décompression Licence: Freeware/gratuit |