左右方框数据移动
<html>
<head>
<title> </title>
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<link href="../../css/index.css" rel="stylesheet" type="text/css" />
<link href="../../css/leftmenu.css" rel="stylesheet" type="text/css" />
<link href="../../css/css.css" rel="stylesheet" type="text/css" />
<link href="../../css/dzkutd.css" rel="stylesheet" type="text/css" />
<script language="JavaScript">
function LTrim(str)
{
var whitespace = new String(" \t\n\r");
var s = new String(str);
if (whitespace.indexOf(s.charAt(0)) != -1)
{
var j=0, i = s.length;
while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
{
j++;
}
s = s.substring(j, i);
}
return s;
}
function GetObjID(ObjName) {
for ( var ObjID=0; ObjID < window.deptSelectForm.elements.length; ObjID++ )
if (window.deptSelectForm.elements[ObjID].name == ObjName ) {
return(ObjID);
break;
}
return(-1);
}
function AppendItem(allMenu, menu, isAll) {
for (j=0; j<document.getElementById(allMenu).length; j++){
if (isAll == true || document.getElementById(allMenu).options[j].selected){
//GET VALUE
document.getElementById(allMenu).options[j].selected = false;
//GET LENGTH
DesLen = document.getElementById(menu).length;
// NEW OPTION
document.getElementById(menu).options[DesLen] = new Option(LTrim(document.getElementById(allMenu).options[j].text), document.getElementById(allMenu).options[j].value);
document.getElementById(allMenu).remove(j);
j--;
}
}
}
function turnUp() {
for (j=0; j<document.getElementById("resultDept").length; j++){
if (document.getElementById("resultDept").options[j].selected){
if (j == 0) {
alert("请从第二个开始选择");
return;
}
//GET VALUE
i = j - 1;
var obj = document.getElementById("resultDept").options[j];
var value = document.getElementById("resultDept").options[i].value;
var text = document.getElementById("resultDept").options[i].text;
document.getElementById("resultDept").options[i].value = obj.value;
document.getElementById("resultDept").options[i].text = obj.text;
document.getElementById("resultDept").options[i].selected = true;
document.getElementById("resultDept").options[j].value = value;
document.getElementById("resultDept").options[j].text = text;
document.getElementById("resultDept").options[j].selected = false;
}
}
}
function turnDown() {
for (j=document.getElementById("resultDept").length-1; j>-1; j--){
if (document.getElementById("resultDept").options[j].selected){
if(j==document.getElementById("resultDept").length - 1) {
alert("请从倒数第二个开始选择");
return;
}
//GET VALUE
i = j + 1;
var obj = document.getElementById("resultDept").options[j];
var value = document.getElementById("resultDept").options[i].value;
var text = document.getElementById("resultDept").options[i].text;
document.getElementById("resultDept").options[i].value = obj.value;
document.getElementById("resultDept").options[i].text = obj.text;
document.getElementById("resultDept").options[i].selected = true;
document.getElementById("resultDept").options[j].value = value;
document.getElementById("resultDept").options[j].text = text;
document.getElementById("resultDept").options[j].selected = false;
}
}
}
function ok()
{
window.close();
}
</script>
</head>
<body>
<table width="50%"style="border-right:solid 1px #aaccef; border-bottom:solid 1px #aaccef; border-top:solid 1px #aaccef; border-left:solid 1px #aaccef;" cellpadding="0" cellspacing="0" bgcolor="#f3f8fb" align="center">
<tr height="30px">
<td colspan=4>
<span>项目查询条件</span>
</td>
</tr>
<tr>
<td width="20%" align="center">
<select id="initDept" name="initDept" size="12" style="width:150px;" multiple="true">
<option value="1">项目状态</option>
<option value="1">项目名称</option>
<option value="1">境内外</option>
<option value="1">所在大区</option>
<option value="1">所在国家</option>
<option value="1">建设地区代码</option>
<option value="1">行业代码</option>
<option value="1">重点行业</option>
<option value="1">业务种类</option>
<option value="1">五级分类</option>
</select>
</td>
<td width="5%" align="center">
<input type="button" value="-->" onClick="return AppendItem('initDept', 'resultDept', false);"/>
<br>
<input type="button" value="==>" onClick="return AppendItem('initDept', 'resultDept', true);"/>
<br>
<br>
<input type="button" value="<--" onClick="return AppendItem('resultDept', 'initDept', false);"/>
<br>
<input type="button" value="<==" onClick="return AppendItem('resultDept', 'initDept', true);"/>
</td>
<td width="20%" align="center">
<select id="resultDept" name="resultDept" style="width:150px;" size="12" multiple="true"></select>
</td>
<td width="5%" align="left">
<input type="button" value="上移" onClick="return turnUp();"/>
<br>
<br>
<input type="button" value="下移" onClick="return turnDown();"/>
</td>
</tr>
<tr height="30px">
<td align="center" colspan=4>
<input type="button" name="确认" value="确定" onClick="javascript:ok()"/>
<input type="button" value="关闭" onClick="javascript:window.close()"/>
</td>
</tr>
</table>
</body>
</html>