<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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 runat="server">
<title></title>
</head>
<body>
<select id="select1" multiple="multiple" style="float:left;">
<option>添加</option>
<option>删除</option>
<option>修改</option>
<option>查询</option>
<option>打印</option>
</select>
<input type="button" value=">" οnclick="move(document.getElementById('select1'),document.getElementById('select2'))"/>
<input type="button" value="<" οnclick="move(document.getElementById('select2'),document.getElementById('select1'))"/>
<input type="button" value=">>" οnclick="moveall(document.getElementById('select1'),document.getElementById('select2'))"/>
<input type="button" value="<<" οnclick="moveall(document.getElementById('select2'),document.getElementById('select1'))"/>
<select id="select2" multiple="multiple">
</select>
</body>
</html>
<script type="text/javascript">
function move(selectSrc,selectDest) {
for (var i = 0; i < selectSrc.childNodes.length; i++) {
var option = selectSrc.childNodes[i];
if (option.selected == true) {
selectSrc.removeChild(option);
selectDest.appendChild(option);
option.selected = "";
i--;
}
}
}
function moveall(selectSrc, selectDest) {
while (selectSrc.childNodes.length != 0)
{
var option = selectSrc.childNodes[0];
selectSrc.removeChild(option);
selectDest.appendChild(option);
option.selected = "";
}
}
</script>
selected移动
最新推荐文章于 2021-08-04 04:08:05 发布