|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14391
- 金币
- 2481
- 威望
- 1647
- 贡献
- 1429
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"- I/ x" a; ?, J. b- s* z
c pageencoding="gb2312"
4 h* g) { y j$ C1 ~( n%>
# k+ l+ v: Y( T c, x% u<style>7 F9 P1 _9 `# q5 g D& b) }" e9 |
.f9{ font-size:9pt; }/ G- o! W" Y2 g7 d+ N z
.bgc{ background-color:#aecaf9; color: #0033ff }
( W( X! U( t; Q3 J.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;" |' R& ?: ~" c8 t
border-bottom: solid 1px #4e7dc1;2 G2 z: W& v; r& i% S; M# m# d
border-left: solid 1px #aecaf9;7 W- }$ \: R9 R- f& e
border-right: solid 1px #5679bd; K- |2 s' q) I! l
padding:1px;
1 N- K% @2 j! F' {0 M& M margin:0px;}
4 G U+ g; Q' a' W</style>" ~. u6 `# E4 d1 t k7 ]6 J% V
<script language="javascript">& W0 w* q0 x, X
<!--. ^8 _0 F1 d' ~7 l( Q& g* `, J, z
function rv()
" z+ k* U' k2 \9 R{
$ f( O0 a- O0 ]0 s; G var val="";% I" ^. Z% A& x4 z% a- y
for(i=0;i<combo_box.list2.length;i++){
: L' `5 W! H o+ @% N' Z) n val+=","+combo_box.list2.value;
* D& W [1 t/ q; Q/ q }
8 D7 {' t( ^, S( u5 j if(val.charat(0)==","){3 Q3 L9 N4 j* c5 q9 H
val=val.substr(1,val.length);: }! m+ W# E0 H# k* j8 q8 x1 J( X; x
}
9 I, N& z8 p; L+ X0 {' l opener.form1.frecname.value=val;
0 f& {9 h, J' Q- U; S- W self.close();1 ^+ P7 G0 c2 Q4 D9 O9 Y
}' [6 c) P4 p. B
//-->" I9 l! G1 o* [- w/ W' n
</script> `- r7 j' A$ m, B
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">6 k8 G) P7 x! T# Z' C. t/ n+ y3 l
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />/ Z; L5 F+ x9 R6 }9 d+ F4 l0 i2 i0 b
<%6 ~, K7 U5 X8 ?
cdatasource ds=new cdatasource(); //数据联结bean实例. k! [$ Q7 O9 C1 o
java.sql.connection conn=ds.getconnection();: q. K0 D- T# z4 P. B4 ^
java.sql.statement stmt=null;
! Q( u$ E1 |1 {8 O& l6 f8 u3 f7 S java.sql.resultset rs=null;0 c9 O/ u/ Q: l
cdatacheck dc=new cdatacheck();
# P1 v M. `8 _! L%>' D9 m6 n" w1 k3 g+ N4 [
<%: u8 R& n+ e7 e- P8 s# a; [
string sqlu="select t1.fno, t1.fname, t2.fname as fdept from tuser t1 left outer join tdept t2 on t1.fdept = t2.fno order by t2.fname";
, E9 F0 C s! R" K. vstmt=conn.createstatement();
% P1 ~' B% D- wrs=stmt.executequery(sqlu);
% D& E9 i0 a3 S. `* n7 a! ?%>, g! @0 r. l) O" |& `
<script language='javascript'>
; n% }9 \" N& E" p, Varr = new array();
+ J: P2 H; g e1 r( ?<% int temp=0;
, V i' E$ Z: s6 X- H! q1 Pwhile(rs.next())3 p* h0 U+ m N& q1 x8 H
{% G4 ? u/ V3 L3 k+ g0 I
%>
7 U4 m% L# N2 L) [( R1 s" V7 |arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");5 |/ F$ _5 x1 q \/ [( G
<%
8 i u* y' A, D- v! F! dtemp = temp + 1;
5 C# J" h/ Q' ~# a" j$ x+ |}
* Q. E8 n! v4 N%>4 k) u! A$ ~5 B
temp=<%=temp%>;9 ` C' o9 J5 I) X# ^2 g$ j0 A
function changelocation(id){
" {, g& n" D; z4 N0 Udocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
0 w. m% P$ |. K/ c2 Pvar i = 0; - ^7 ]* m& g5 y( f6 T8 C7 [" f
document.combo_box.city.options[0]=new option('-------','');
3 [/ B+ }4 u5 x/ Z6 X# efor(i=0;i<temp;i++){
& G4 i9 q* I( g! D- ?# o( Mif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
1 I- n C/ e c5 `document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
" \" w4 |2 ^3 L; A3 X# `' E" T3 T}
6 v; V2 A7 i2 _6 U. Q& v} * ]4 r- x- j0 }8 k# S
}
, D N9 R( t; g! y5 c' m" b! j6 A</script>5 m! r& Y4 E8 A# p
. \+ H$ X f3 b8 B5 X* {<form name="combo_box">/ X d' j; o1 q, V' T: W
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
) R% s) d* k! U# j3 h <tr height="24">
& G; f; M) k9 T* x4 z7 i <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>) c, s6 P1 ~0 z! M6 V! \* p
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
- t# a3 B/ H! Y0 x4 i$ h; K <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
2 }6 ]* P/ A# ^5 h1 _$ m) O <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>6 Y, B# c9 `9 b: W: e; E
</tr>
0 F# B+ |4 Z2 }9 x2 O: m5 q <tr> : A8 ?6 O" j* p2 R( f5 d0 L/ m3 I
<td>4 u6 O9 c; `) f9 z1 S; T8 Q* ^
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
! A" ~5 W- ~8 d( C7 W& q3 s <option value="0">请选择部门 ---></option>
7 @+ `% ^& x/ m( A/ A& {) k) Y<%
$ a5 R. j- {1 b0 V2 k6 q string sqld="select * from tdept";6 z7 v t5 a8 [+ A+ O: ^7 {
stmt=conn.createstatement();
5 h! I* f* R6 W) o1 Y( ]rs=stmt.executequery(sqld);
$ A5 i$ p! J$ R( L6 S# Wwhile(rs.next())
( ~8 \! g+ V. m% _7 Q5 J{. n) l) ?% h) w6 K% c
%># z1 [0 O6 L' P, q2 _ D) y
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
0 ~. F1 O# R8 y$ _( U+ _<%
3 d, @* I3 P" a; A$ R g6 z}
3 j6 n! S" a P L%>
) X! Q# P+ g" ^" X# F3 E/ M& o/ X7 T </select>
6 I# n! o, u- S</td>/ e/ M4 f' l. Y6 k8 [) ~! w
<td>
0 p( w6 ]# V: a, e* ~: |7 e9 y <select multiple id=city style="width:150;height:200" class="bgc">
$ T1 N; S$ {0 {2 w! v </select>
i' t9 J$ B8 t/ ?! m</td>
- f7 e7 e) Z- w7 {2 C! F <td nowrap align="center" class="bgc">! u. W3 a8 F* o, G* u: q2 k# w" B$ R
<input type="button" value="<<" class="buttons">% x- V: L0 o8 _; l8 {
<input type="button" value=">>" class="buttons">% E I2 B9 E+ c. _& s
</td>8 ~- t# i) x! i; `3 z
<td>
) R8 {+ P" p3 F0 u" o <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
+ v+ p- m5 ?& ]* }2 f) ^* n. h </select>- [7 v3 x! g/ {; K
</td>
3 c! @4 w% @, @ </tr>% J% @ O1 @% x' F
<tr class="bgc"> 2 @7 Q b! p& h" S/ D8 J
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>0 c2 G3 n6 I1 C8 w
</tr>
' K7 j& {2 y' k/ E& ^</table>& E% Y/ V2 G" T' v6 R% N6 Y
</form>0 k0 i7 K1 i! U+ k' d. G% s
<script language="javascript">! ]" H: d7 Z5 s0 D" B3 P
//人名移动 n; \* k6 ] I* A7 Z
function move(fbox, tbox) {- }5 K* }; m8 {: K. L6 o0 W
var arrfbox = new array();
2 X% |8 Y3 a! D& ]+ d. t, ovar arrtbox = new array();
+ l& t& g( {' R$ M3 @$ Fvar arrlookup = new array();3 r5 C6 w1 m; B4 ^' g
var i;
2 D8 a$ a( h4 @for (i = 0; i < tbox.options.length; i++) {
9 r/ P8 o% m( l! xarrlookup[tbox.options.text] = tbox.options.value;
$ r" [0 S; f2 f3 d2 y) i- Aarrtbox = tbox.options.text;& ^! W/ q: u' y) R
}; i! e* k5 ]; V
var flength = 0;/ {0 A( d. C) E) x& e. z
var tlength = arrtbox.length;7 n; y6 B2 w+ m: ^' w: K- l& o
for(i = 0; i < fbox.options.length; i++) {1 q! g" r& O7 H: M8 i
arrlookup[fbox.options.text] = fbox.options.value;- h' s# x/ D6 b0 Q! [- l
if (fbox.options.selected && fbox.options.value != "") {) B& f. O0 L6 Q$ \8 W
arrtbox[tlength] = fbox.options.text;4 V2 H3 x; V& E4 q0 Y3 L g
tlength++;
! P$ a5 x, d' N# ^- {}
2 Y0 }2 N9 r% b; x9 e) melse {
3 n K6 p) l, X5 y Earrfbox[flength] = fbox.options.text;
6 G. ]3 V- V) m3 M, @3 `7 lflength++;
! `& `0 N0 o; f$ G/ D }$ z( q1 d8 ^) r+ I4 y# ^
}& [# q7 e2 c! p! k" u5 x
arrfbox.sort();4 v4 Q) ~4 u5 _* l1 i1 i; H
arrtbox.sort();
/ f/ R f( T' J4 c4 r b5 p' V" B o6 k6 y' C- e4 b
fbox.length = 0;" o' v( H$ e. h& p# R3 S
tbox.length = 0;4 K: D+ ]$ Y& s* |# T- Q! x) g6 o) ]
var c;# u, } @! e# ?' w* y
for(c = 0; c < arrfbox.length; c++) {
7 |$ h2 A9 T7 Wvar no = new option();
( r& Z+ ?1 f- T5 N a4 C# }no.value = arrlookup[arrfbox[c]];
2 k1 t4 U3 p, M9 C) Pno.text = arrfbox[c];
! B: t8 l( i* @* N8 ?* ?/ Sfbox[c] = no;
. F5 j/ t- T; u8 M$ y}
; c! X! ^5 G9 o# [0 _4 cfor(c = 0; c < arrtbox.length; c++) {: w9 r, {0 L3 S9 x! s( D
var no = new option();" q1 c$ D/ K: ~0 n$ I
no.value = arrlookup[arrtbox[c]];
' M* }$ @3 w. L0 l" y& Tno.text = arrtbox[c];; ~3 f5 R& ]" N1 I: U/ \2 K
tbox[c] = no;3 V$ i. |: ]( [* l: L5 ^7 s3 ]
}5 s" V9 J, g& \7 v) y3 T3 @
}
$ x/ l0 r3 j* O1 O</script>9 K% L$ p% F' A2 N- b" m7 a
</body>
, |7 B+ ^2 S v |
|