<div>
<div>
<select id="select2" multiple="multiple" style="width: 200px;height: 200px;">
<option>棒球</option>
<option>高尔夫球</option>
</select>
</div>
<input type="button" value="选中添加到左边" onclick="selToLeft();"/><br/>
<input type="button" value="全部添加到左边" onclick="allToLeft();"/>
</div>
</body>
<script type="text/javascript">
function selToRight(){
var select1=document.getElementById("select1");
var select2=document.getElementById("select2");
var options1=select1.getElementsByTagName("option");
for(var i=0;i<options1.length;i++){
if(options1[i].selected==true){
select2.appendChild(options1[i]);
i--;
}
}
}
function allToRight(){
var select11=document.getElementById("select1");
var select21=document.getElementById("select2");
var options11=select11.getElementsByTagName("option");
for(var j=0;j<options11.length;j++){
select21.appendChild(options11[j]);
j--;
}
}
function selToLeft(){
var select22=document.getElementById("select2");
var select12=document.getElementById("select1");
var ops=select22.getElementsByTagName("option");
for(var k=0;k<ops.length;k++){
if(ops[k].selected==true){
select12.appendChild(ops[k]);
k--;
}
}
}
function allToLeft(){
select23=document.getElementById("select2");
select13=document.getElementById("select1");
var ops1=select23.getElementsByTagName("option");
for(var m=0;m<ops1.length;m++){
select13.appendChild(ops1[m]);
m--;
}
}
</script>
</html>