js多选框左移

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
  <meta http-equiv="pragma" content="no-cache">
 <meta http-equiv="cache-control" content="no-cache">
 <meta http-equiv="expires" content="0">   
 <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
 <meta http-equiv="description" content="This is my page">
<LINK href="${color}/css.css" type=text/css rel=stylesheet>
<SCRIPT language=javascript src="js/iframe.js"></SCRIPT>
 <script language="javascript">
  function checkInput(){
  if(document.all.rightList.length==0){
  alert("请选择部门或人员");
  return false;
  }
  var str="";
  for(var i=0;i<document.all.rightList.length;i++){
  str=document.all.rightList.options[i].value+";"+str;
  }
  document.form1.sendMember.value = str;
  document.all.form1.submit();
  }
  function UserMove (nType) {
    if (nType == 0) return moveItem (document.all.leftList, document.all.rightList, false);
    if (nType == 1) return moveItem (document.all.rightList, document.all.leftList, false);
    if (nType == 2) return moveItem (document.all.leftList, document.all.rightList, true);
    if (nType == 3) return moveItem (document.all.rightList, document.all.leftList, true);
}

//移动选中的项目
function moveItem (sObj, tObj, allFlg) {
 if (sObj==null || tObj==null) return;
    var i=0;
    while (sObj.length > i) {
     if (allFlg || sObj.options(i).selected) {
      createOption(tObj, sObj.options(i).text, sObj.options(i).value);
        sObj.remove (i);
     } else {
      i++;
     }
    }
    sObj.selectedIndex = -1;
    tObj.selectedIndex = -1;
    return;
}
  function createOption(s, txt, v) {
 var eItem = document.createElement ("OPTION");
 s.add (eItem);
 eItem.innerText = txt;
 eItem.value = v;
}
function dept(){
document.all.leftList.options.length=0;
var j=0;
var ttt=new Array;
<logic:present name="dept">
 <logic:iterate id="et" name="dept">
  <logic:present name="et">
ttt[j]=new Array('<bean:write name="et" property="deptName"/>');
j++;
</logic:present>
</logic:iterate>
</logic:present>
for(m = 0;m<j;m++){
      createOption(document.all.leftList, ttt[m][0], ttt[m][0]);
 }
}
function user(){
document.all.leftList.options.length=0;
var j=0;
var ttt=new Array;
<logic:present name="user">
 <logic:iterate id="et" name="user">
  <logic:present name="et">
ttt[j]=new Array('<bean:write name="et" property="name"/>','<bean:write name="et" property="userShowId"/>');
j++;
</logic:present>
</logic:iterate>
</logic:present>
for(m = 0;m<j;m++){
      createOption(document.all.leftList, ttt[m][0], ttt[m][1]);
 }
}
  </script>
    <base target="_self">
</head>

<body marginwidth="0" topmargin="0" leftmargin="0" marginheight="0">
  <%Tools tool=new Tools();
   tool.getUsers(request);
   tool.getDept(request);
   %>
<%
String timecheck = String.valueOf(System.currentTimeMillis());
request.getSession().setAttribute("timecheck", timecheck);
%>
  <form name="form1" method="post" action="manageIncept.do">
  <input type="hidden" name="id" value="<%=request.getParameter("id") %>">
  <input type="hidden" name="sendMember">
  <input type="hidden" name="active" value="send">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
 
  <tr>
    <td align="center" valign="top" background="${color}/oa_39.gif" class="xian1"><table width="92%" border="0" cellpadding="0" cellspacing="3" bgcolor="#F5F5F5" class="lankuang" style="margin:15px 0 15px 0;">
      <tr>
        <td colspan="7" align="center" bgcolor="#FFFFFF">
          <table width="96%" border="0" cellspacing="5" cellpadding="0" style="margin:10px 0 10px 0;">
            <tr>
        <td width="102"><input type="radio" name="radiobutton" value="dept" οnclick="return dept();">
        指定部门</td>
        <td width="97"><input type="radio" name="radiobutton" value="people" checked οnclick="return user();">指定人员</td>
        <td width="19">&nbsp;</td>
        <td width="62"></td>
        <td width="85"></td>
      </tr>
      <tr>
        <td colspan="2"></td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td colspan="2" rowspan="4"><select name="leftList" size=2 style='height:200px;width:200px;'>
        <logic:present name="user">
   <logic:iterate id="ac" name="user">
   <logic:present name="ac"> 
          <option value="<bean:write name="ac" property="userShowId"/>"><bean:write name="ac" property="name"/></option>
          </logic:present>
          </logic:iterate>
          </logic:present>
        </select></td>
        <td><input type="button" name="Submit" onClick="UserMove(1)" value="<"></td>
        <td colspan="2" rowspan="4"><select name="rightList" size=2 style='height:200px;width:200px;'>
        </select></td>
      </tr>
      <tr>
        <td><input type="button" name="Submit2" onClick="UserMove(0)" value=">"></td>
      </tr>
      <tr>
        <td><input type="button" name="Submit3" onClick="UserMove(3)" value="<<"></td>
      </tr>
      <tr>
        <td><input type="button" name="Submit4" onClick="UserMove(2)" value=">>"></td>
      </tr>
      <tr>
        <td colspan="5">
        <input type="button" name="Submit6" onClick="checkInput()" value="确定选择">
        <input type="button" name="Submit7" onClick="window.close()" value="关闭"></td>
      </tr>
            
          </table>
        </td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
 
  </body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值