两个select通过js 进行数据交换
<script language="javascript">
/**
* moveSelections动态交换多选列表全部数据
* @param arg0 数据来源
* @param rag1 交换对象
*/
function moveSelections(arg0, arg1) {
for (var i=0; i<arg0.options.length; i++) {
var op = arg0.options[i];
arg1.options.add(new Option(op.text, op.value));
arg0.remove(i);
i = i-1;
}
}
/**
* moveSelected动态交换多选列表选择的数据
* @param arg0 数据来源
* @param rag1 交换对象
*/
function moveSelected(arg0, arg1) {
for (var i=0; i<arg0.options.length; i++) {
if (arg0.options[i].selected) {
var op = arg0.options[i];
arg1.options.add(new Option(op.text, op.value));
arg0.remove(i);
i = i-1;
}
}
}
</script>
<body>
<form name="" method="post" action="" onsubmit="window.close();">
<table width="150" height="250" border="0" align="center">
<tr style="height: 90%">
<td width="48%" class="txtd">
<select name="menuNotInRole" size="12" multiple id="menuNotInRole" style="width:100px;height:100%;" ondblclick="moveSelected(document.getElementById('menuNotInRole'), document.getElementById('infoRole.menu_ids'))">
<option value="1">现场经理</option>
<option value="2">省公司人员</option>
<option value="3">测试执行人员</option>
<option value="4">集成商人员</option>
</select>
</td>
<td>
<input type="button" value=">>" onClick="moveSelected(document.getElementById('menuNotInRole'), document.getElementById('infoRole.menu_ids'))"></input><br /><br />
<input type="button" value="<<" onClick="moveSelected(document.getElementById('infoRole.menu_ids'), document.getElementById('menuNotInRole'))"></input>
</td>
<td width="48%" class="txtd">
<select name="infoRole.menu_ids" size=12 multiple id="infoRole.menu_ids" style="width:100px;height:100%;" ondblclick="moveSelected(document.getElementById('infoRole.menu_ids'), document.getElementById('menuNotInRole'))">
<option value="5">项目经理</option>
</select></td>
</tr>
<tr>
<td colspan="3" align="center">
<input type="submit" value="确定" ></input> <input type="reset" value="取消" />
</td>
</tr>
</table>
</form>
</body>