roleuser.jsp
上传用户:lm2018
上传日期:2015-12-12
资源大小:30449k
文件大小:5k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@ page language="java" pageEncoding="GBK"%>
  2. <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
  3. <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
  4. <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
  5. <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
  6. <link href="<%=request.getContextPath()%>/Css_file/oa.css" rel="stylesheet" type="text/css" />
  7. <body onload="init();">
  8. <form id="form1" name="form1" method="post" action="">
  9. <table width="100%" border="0" class="myTable">
  10. <tr>
  11.    <td>
  12. <select id="left" name="left"  onDblClick="move(form1.left,form1.right);" multiple size="10">
  13.       
  14.        <logic:equal name="type" value="user" scope="request">
  15.        <logic:iterate id="list" name="list" scope="request">
  16.        <option value="${list.uno}">${list.utruename}</option>
  17.         </logic:iterate> 
  18.         </logic:equal>
  19.        <logic:equal name="type" value="role" scope="request">
  20.        <logic:iterate id="list" name="list" scope="request">
  21.        <option value="${list.rid}">${list.rname}</option>
  22.         </logic:iterate> 
  23.         </logic:equal>       
  24.         <logic:equal name="type" value="transrole" scope="request">
  25.        <logic:iterate id="list" name="list" scope="request">
  26.        <option value="${list.rid}">${list.rname}</option>
  27.         </logic:iterate> 
  28.         </logic:equal>       
  29.        
  30.        </select> 
  31. </td>
  32. <td>
  33. <input class="tableHead"  type="button" name="a" value="左移一个" onClick="move(form1.right,form1.left)"><br>
  34. <input class="tableHead"  type="button" name="c" value="右移一个" onClick="move(form1.left,form1.right)"><br>
  35. <input class="tableHead"  type="button" name="b" value="全部左移" onClick="moveAll(form1.right,form1.left)"><br>
  36. <input class="tableHead"  type="button" name="d" value="全部右移" onClick="moveAll(form1.left,form1.right)">
  37. </td>
  38. <td>
  39. <select id="right" name="right" onDblClick="move(form1.right,form1.left)" multiple size="10">
  40. </select>
  41. </td>
  42. </tr>
  43. <tr>
  44. <td align="center" colspan="3">
  45. <input type="button" name="ok" value="确定" onClick="returnOpener();">&nbsp;&nbsp;
  46. <input type="button" name="canel" value="取消" onClick="window.close();">
  47. </td>
  48. </tr>
  49. </table>
  50. </from>
  51. </body>
  52. <script>
  53. function init()
  54. {
  55. var select_right = document.getElementById("right");
  56. var name = opener.document.all("${requestScope.type}${requestScope.id}").value.split(",");
  57. var id = opener.document.all("${requestScope.type}id${requestScope.id}").value.split(",");
  58. if (name != null && name != "")
  59. {
  60. for(var i=0; i<name.length; i++)
  61. {
  62. select_right.options[i] = new Option(name[i], id[i]);
  63. }
  64. clearleftValue();
  65. }
  66. }
  67. function clearleftValue(){
  68. var select_left = document.getElementById("left");
  69. var select_right = document.getElementById("right");
  70. if(select_right.length>0){
  71. for(var i=0;i<select_right.length;i++){
  72. for(var j=0;j<select_left.length;j++){
  73. if(select_left.options[j].value==select_right.options[i].value){
  74. select_left.remove(j);
  75. //i--;
  76. break;
  77. }
  78. }
  79. }
  80. }
  81. function move(from,to){
  82. for(var i = 0;i<from.options.length;i++){
  83. if(from.options[i].selected == true){
  84. to.options[to.options.length] = new Option(from.options[i].text,from.options[i].value);
  85. from.options[i] = null;
  86. i--;
  87. }
  88. }
  89. }
  90. function moveAll(from,to){
  91. for(var i = 0;i<from.options.length;i++){
  92. to.options[to.options.length] = new Option(from.options[i].text,from.options[i].value);
  93. from.options[i] = null;
  94. i--;
  95. }
  96. }
  97. function returnOpener(){
  98. var id = parseInt("${requestScope.id}", 10);
  99. var tValue = opener.document.all("${requestScope.type}${requestScope.id}");
  100. var rValue = opener.document.all("${requestScope.type}id${requestScope.id}");
  101. var vv = ""
  102. var vr = ""
  103. tValue.value = "";
  104. rValue.value = "";
  105. var select_right = document.getElementById("right");
  106. for (var i=0;i<select_right.length;i++){
  107. if (vv == "" && vr == ""){
  108. vv = select_right[i].text;
  109. vr = select_right[i].value;
  110. }
  111. else{
  112. vv = vv + ","+select_right[i].text;
  113. vr = vr + ","+select_right[i].value;
  114. }
  115. }
  116. tValue.value = vv;
  117. rValue.value = vr;
  118. window.close();
  119. }
  120. </script>