权限选择

<!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 src="jquery-1.4.2.min.js"></script>
<script language="javascript" type="text/javascript">
 function MoveSelect(selectSrc,selectDest){
   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 MoveAllSelect(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 id="select1" multiple="multiple" style="60px">
<option>选择</option>
<option>添加</option>
<option>修改</option>
<option>查询</option>
<option>打印</option>
</select>
<input type="button" value=">" onclick="MoveSelect(document.getElementById('select1'),document.getElementById('select2'))"/>
<input type="button" value="<" onclick="MoveSelect(document.getElementById('select2'),document.getElementById('select1'))" />
<input type="button" value=">>" onclick="MoveAllSelect(document.getElementById('select1'),document.getElementById('select2'))"/>
<input type="button" value="<<" onclick="MoveAllSelect(document.getElementById('select2'),document.getElementById('select1'))"/>
<select id="select2" multiple="multiple" style="60px">
</select>
</body>
</html>

原文地址:https://www.cnblogs.com/caishuowen/p/2011294.html