<script type="text/javascript">
function moveSelected(selectSrc,selectDest){//selectSrc是源select,selectDest是目标select
for(var i=selectSrc.childNodes.length-1;i>=0;i--){
var option = selectSrc.childNodes[i];
if(option.selected==true){
selectSrc.removeChild(option);
option.selected=false;
selectDest.appendChild(option);
}
}
}
function moveAll(selectSrc,selectDest){
for(var i=selectSrc.childNodes.length-1;i>=0;i--){
var option = selectSrc.childNodes[i];
selectSrc.removeChild(option);
selectDest.appendChild(option);
}
}
</script>
</head>
<body>
<select style="float:left; width:10%;" id="select1" multiple="multiple">
<option>添加</option>
<option>删除</option>
<option>修改</option>
<option>查询</option>
<option>打印</option>
</select>
<div style="float:left;width:5%;">
<input style="float:left;width:100%" type="button" value=">" οnclick="moveSelected(document.getElementById('select1'),document.getElementById('select2'))" /><input style="float:left;width:100%;" type="button" value="<" οnclick="moveSelected(document.getElementById('select2'),document.getElementById('select1'))" /><input style="float:left;width:100%" οnclick="moveAll(document.getElementById('select1'),document.getElementById('select2'))" type="button" value=">>" />
<input style="float:left;width:100%" οnclick="moveAll(document.getElementById('select2'),document.getElementById('select1'))" type="button" value="<<" />
</div>
<select style="float:left;width:10%" id="select2" multiple="multiple"></select>
</body>
</html>
function moveSelected(selectSrc,selectDest){//selectSrc是源select,selectDest是目标select
for(var i=selectSrc.childNodes.length-1;i>=0;i--){
var option = selectSrc.childNodes[i];
if(option.selected==true){
selectSrc.removeChild(option);
option.selected=false;
selectDest.appendChild(option);
}
}
}
function moveAll(selectSrc,selectDest){
for(var i=selectSrc.childNodes.length-1;i>=0;i--){
var option = selectSrc.childNodes[i];
selectSrc.removeChild(option);
selectDest.appendChild(option);
}
}
</script>
</head>
<body>
<select style="float:left; width:10%;" id="select1" multiple="multiple">
<option>添加</option>
<option>删除</option>
<option>修改</option>
<option>查询</option>
<option>打印</option>
</select>
<div style="float:left;width:5%;">
<input style="float:left;width:100%" type="button" value=">" οnclick="moveSelected(document.getElementById('select1'),document.getElementById('select2'))" /><input style="float:left;width:100%;" type="button" value="<" οnclick="moveSelected(document.getElementById('select2'),document.getElementById('select1'))" /><input style="float:left;width:100%" οnclick="moveAll(document.getElementById('select1'),document.getElementById('select2'))" type="button" value=">>" />
<input style="float:left;width:100%" οnclick="moveAll(document.getElementById('select2'),document.getElementById('select1'))" type="button" value="<<" />
</div>
<select style="float:left;width:10%" id="select2" multiple="multiple"></select>
</body>
</html>