<html>
<head>
<script language="javascript">//移动选中的项
function moveSelected(fromList,toList)
{
  var isExisSame=0
  for(var i=0;i<fromList.options.length;i++)
  {
    if(fromList.options[i].selected)
    {  
       for(var j=0;j<toList.options.length;j++)
       {
         for(fromList.options[i].value==toList.options[j].value)
         {
           isExisSame=1
           break;
         }
       } 
       if(!isExisSame)
       {
         toList.options.add(new Option(fromList.options[i].text,fromList.options[i].value))      
       }
       isExisSame=0
    }
  }
}//移除所有的项
function removeAll(list)
{
  for(var i=0;i<list.options.length;i++)
     list.remove(i);
}
//移动所有的项
function moveAll(fromList,toList)
{
  removeAll(toList);
  for(var i=0; i<fromList.options.length;i++)
    toList.options.add(new Option(fromList.options[i].text,fromList.options[i].value))
}
//移除选中的项
function removeSelected(list)
{
  for(var i=0;i<list.options.length;i++)
    if(list.options[i].selected)
    {
       toList.options.remove(i);
    }
}function test()
{
  alert("hello world");
}
</script>
</head>
<body style="margin-left:20px">
<form name="test">
<table align="center">
<tr>
<td><select name="fromList" multiple size="10" style="width:120px" >
<option value="1" >C</option>
<option value="2" >JAVA</option> 
<option value="3" >JAVASCRIPT</option> 
<option value="4" >AJAX</option> 
<option value="5" >PERL</option>
<option value="6" >Dot NET</option>
<option value="7" >VB.NET</option>
<option value="8" >C++</option>
</select></td>
<td>
<p><input onclick="javascript:moveSelected(document.test.fromList,document.test.toList);"   type="button" name="moveSelected" style="width:150px" value="rightMove >>"/></p>
<p><input onclick="javascript:moveAll(document.test.fromList,document.test.toList);"        type="button" name="moveAll" style="width:150px"value="moveAll >>"/></p>
<p><input onclick="javascript:removeSelected(document.test.toList);"                        type="button" name="removeSelected" style="width:150px"value="removeSelected"/></p>
<p><input onclick="javascript:removeAll(document.test.toList);"                             type="button" name="removeAll" style="width:150px"value="removeAll"/></p>
</td>
<td><select name="toList" multiple size="10" style="width:120px" ></select></td>
</tr>
</table>
</form>
</body>
</html>