codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>test</title>
<script language="javascript">
function moveItem(theListBox1, theListBox2, theWay)
{
if(theWay == "right")
{
if(theListBox1.selectedIndex == -1)
return false;
theListBox2.options[theListBox2.length] = new Option(theListBox1.options[theListBox1.selectedIndex].label, theListBox1.options[theListBox1.selectedIndex].value);
theListBox2.options[theListBox2.length-1].label = theListBox1.options[theListBox1.selectedIndex].label;
theListBox1.options[theListBox1.selectedIndex] = null;
}
if(theWay == "left")
{
if(theListBox2.selectedIndex == -1)
return false;
theListBox1.options[theListBox1.length] = new Option(theListBox2.options[theListBox2.selectedIndex].label, theListBox2.options[theListBox2.selectedIndex].value);
theListBox1.options[theListBox1.length-1].label = theListBox2.options[theListBox2.selectedIndex].label;
theListBox2.options[theListBox2.selectedIndex] = null;
}
}
</script>
</head>
<body>
<table>
<tr>
<td>
<select name="myListboxOne" size="10">
<option label="Valore 1" value="1">Valore 1</option>
<option label="Valore 2" value="2">Valore 2</option>
<option label="Valore 3" value="3">Valore 3</option>
<option label="Valore 4" value="4">Valore 4</option>
<option label="Valore 5" value="5">Valore 5</option>
</select>
</td>
<td>
<input type="button" value=">>" id="myCmd" onClick="Javascript:moveItem(myListboxOne, myListboxTwo, 'right');">
<input type="button" value="<<" id="myCmd" onClick="Javascript:moveItem(myListboxOne, myListboxTwo, 'left');">
</td>
<td>
<select name="myListboxTwo" size="10">
</select>
</td>
</tr>
</table>
</body>
</html>