<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="jquery-1.11.0.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#allToRight").click(function(){
$("#select1 option").appendTo("#select2");
})
$("#allToLeft").click(function(){
$("#select2 option").appendTo("#select1");
})
$("#selectedToRight").click(function(){
alert($("#select1 option:selected").size());
$("#select1 option:selected").appendTo("#select2");
})
$("#selectedToLeft").click(function(){
$("#select2 option:selected").appendTo("#select1");
})
})
</script>
</head>
<body>
<!-- multiple设置是否可以多选 -->
<select multiple="true" style="height: 300px; width: 100px;float:left;" id="select1">
<option value="1">选项1</option>
<option value="2">选项2</option>
<option value="3">选项3</option>
<option value="4">选项4</option>
<option value="5">选项5</option>
<option value="6">选项6</option>
<option value="7">选项7</option>
<option value="8">选项8</option>
<option value="9">选项9</option>
<option value="10">选项10</option>
</select>
<div style="float:left;padding: 10px;">
<input type="button" value="-->" id="selectedToRight"/><br/>
<input type="button" value="==>" id="allToRight"/><br/>
<input type="button" value="<--" id="selectedToLeft"/><br/>
<input type="button" value="<==" id="allToLeft"/>
</div>
<select multiple="true" style="height: 300px; width: 100px;float:left;" id="select2">
</select>
</body>
</html>