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
|
<script language="Javascript">
function affecte(aff,unaff) // AFFECTATION LIGNE PAR LIGNE
{
sel=unaff.options.selectedIndex; // Indice de l'élément sélectionné
if (sel != -1) // Si -1, aucune sélection
{
aff_txt = unaff.options[sel].text; // Nom de l'élément de la liste
aff_val = unaff.options[sel].value; // Nom du value
aff_opt = new Option(aff_txt,aff_val,1,0);
// On crée un nouvel élément: nom affiché + nom value
// 3ème paramètre: defaultSelected
// 4ème paramètre: selected
aff.options[aff.options.length] = aff_opt; // On insère l'élément dans la nouvelle liste
unaff.options[sel] = null; // On enlève l'élément transféré de la liste de départ
}
else
{
window.alert("Sélectionner une catégorie");
}
}
function affectetout(aff,unaff) // AFFECTATION DES LIGNES SELECTIONNEES
{
ind=(unaff.options.length);
for (a = 0; a < ind; a += 1)
{
sel=unaff.options.selectedIndex;
if (sel != -1)
{
aff_txt = unaff.options[sel].text;
aff_val = unaff.options[sel].value;
aff_opt = new Option(aff_txt,aff_val,1,0);
aff.options[aff.options.length] = aff_opt;
unaff.options[sel] = null;
}
}
}
</script>
<form action="EC_Params_Aff.php?id_site=<?=$_GET['id_site'];?>" method="post" name="form1">
<table>
<tr>
<td>
<select multiple name="listunselect" id="listunselect" style="width:200px; " size="<?=$nb_cat;?>" OnDblClick="javascript:affecte(this.form.listselect,this.form.listunselect)">
<?=$liste1;?>
</select>
</td>
<td align="center">
<input type="button" name="boutvG" value="<" onclick="javascript:affecte(this.form.listunselect,this.form.listselect)"><br><br>
<input type="button" name="boutvD" value=">" onclick="javascript:affecte(this.form.listselect,this.form.listunselect)"><br><br>
</td>
<td>
<select multiple name="sel_cat[]" id="listselect" style="width:200px; " size="<?=$nb_cat;?>" OnDblClick="javascript:affecte(this.form.listunselect,this.form.listselect)">
<?=$liste2;?>
</select>
</td>
</tr>
<tr>
<td colspan="3">
</td>
</tr>
<tr>
<td colspan="3" align="center">
<input type="submit" name="ValidForm" value="Enregistrer" onclick="selectionnerTout('form1','sel_cat'); document.form1.submit();">
</td>
</tr>
</table>
</form> |
Partager