  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14197
- 金币
- 2389
- 威望
- 1647
- 贡献
- 1337
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
, ~. F* O9 a- i1 _# Q c pageencoding="gb2312"
) |, S+ ?0 v; a: K {" g E%>' |) k* D }# f* o( }
<style>
3 y& q2 Z' W3 m.f9{ font-size:9pt; }6 c& n x$ O- l; U3 g) z% ]
.bgc{ background-color:#aecaf9; color: #0033ff }
/ ?+ M; p; a4 I S% s$ m2 T.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
, I, ?) C3 G( ] border-bottom: solid 1px #4e7dc1;
% R! d' R8 g, Z# v t border-left: solid 1px #aecaf9;: Q9 o0 ~& _7 W5 T2 F- z+ M, s4 p% |
border-right: solid 1px #5679bd;% C; t! X Y5 w$ L2 c T/ i. H2 ]
padding:1px;* R7 l+ a7 ]* i; h' E1 u
margin:0px;}) l. D( i F! h( O4 U d( p2 ~
</style>
5 V+ s3 A g, u9 ]5 y<script language="javascript">
, q! h2 C# `$ c9 p4 N+ a: j<!--
1 ~# }. p5 F/ e9 a0 Ffunction rv()1 U6 I) i* ~* n" q/ b) N
{$ |0 W6 P& E9 W: {2 t0 z, F5 a" y
var val="";
# A. \6 v5 J, R2 L for(i=0;i<combo_box.list2.length;i++){
" f" z* _, w. ~" d& a- p- } val+=","+combo_box.list2.value;3 L" C& R @- L4 c8 |
}& z8 E2 _3 \" o: V/ M
if(val.charat(0)==","){# _4 I, l, b5 u7 y' D/ @7 q
val=val.substr(1,val.length);6 q; h& X M" e
}
7 d' Z% _/ v* X- R- N5 s opener.form1.frecname.value=val;
. \5 a& Y! u* K7 w' L. f) A self.close();
, C8 h6 @ O$ |, G/ Y% j% r1 y G}
* j6 M$ h) `4 k* t" l//-->1 ^3 v5 j. g8 L9 {
</script>
! x l$ f; Z1 Y8 O6 d<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">; B8 ^6 w1 p5 A
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
- J: Y4 j7 T& {8 S% U8 w/ z<%+ h8 V$ D) @7 c& e* _# _
cdatasource ds=new cdatasource(); //数据联结bean实例
# i& c5 T1 h( P9 Y X( W" i java.sql.connection conn=ds.getconnection();) B( D% Y: r9 Z; M
java.sql.statement stmt=null;% l p- z- A4 ?. @9 u' }) F
java.sql.resultset rs=null;8 ? z4 R4 o9 z# a
cdatacheck dc=new cdatacheck();" l% Y& q2 v5 U6 b7 Q% `
%>
3 ], |" ]0 U# L# S7 H0 @, z9 L<%8 Y5 v+ }0 I: k- l' ^# ]* [
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";
# W8 w6 J m* W7 \) g1 O- F, h3 ]* gstmt=conn.createstatement();
0 H' z' R) v9 vrs=stmt.executequery(sqlu);
$ U' @+ U' p9 ?9 A" N# D$ ~%>
$ e2 s0 L9 r$ |' ] ^7 L) G2 g<script language='javascript'>
- L$ ^- c( o' X+ d2 Zarr = new array();
- Q; V/ a( w; ~8 {9 i<% int temp=0;
5 L: U! n7 ^( B* P; dwhile(rs.next())
' C+ c7 [5 ] k3 W8 A{
, N( a( F$ r( u* V6 @% ^7 o%>- _4 N6 q! F& A, u# P- g/ \( p
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
- s: h2 D s0 [/ F( T8 l8 F<%) t* K# W6 y6 |9 v5 W3 ]. c
temp = temp + 1;- P3 k. r4 G! Z: \
}
% H2 G+ ~7 K4 k& |4 ^# g1 z. I%>+ q, @( Z% M6 d& p$ I
temp=<%=temp%>;
# U' L6 }4 R3 R* X/ n5 Cfunction changelocation(id){ ; I$ N' B5 L G8 ]5 K; b
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
/ N2 n' M I; m6 \" Tvar i = 0;
W# G& ^3 c" r1 Z' Q: R$ Ndocument.combo_box.city.options[0]=new option('-------','');
9 I7 _' s$ R) Wfor(i=0;i<temp;i++){ 4 M2 b8 r& r' }' Q# h( v8 S
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] 4 O8 Y3 y; L+ \0 |
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); 8 i ~& R8 ]. u
} ) K: E+ `1 z* K
}
$ _6 {% s3 \6 @1 Z} 6 l' N" u2 d# b+ b# P
</script>
& [ T- Q4 [8 c- d8 [
- C, x5 t7 y- z3 e$ k<form name="combo_box">5 x: F; \- t: Q
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
; s4 L' G7 g5 o6 M! d5 Y$ n# s7 G <tr height="24">6 h, z6 t! Z( R3 Y8 S a: _& n3 L: o5 v
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td> M4 `8 G, K# ~$ w
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>1 s: A# j" J; `+ \3 e( b9 _1 |/ ]
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>7 T0 S. R/ m$ S+ d) g
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
/ [' G% p& i6 h% t" W </tr>' O; E! k: {$ M8 D! j% r
<tr> : A" Z2 w$ n* ?2 J) [) v* k
<td> k# ^3 A7 m Y6 g+ b" N( A
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">% h& a3 x( ^. k' V& Z0 @( l
<option value="0">请选择部门 ---></option>* q7 g. G% h' q2 _
<%6 Y' p0 L) S+ @' m$ h. l1 T
string sqld="select * from tdept";% l Y0 g$ j: c% m/ z7 L
stmt=conn.createstatement();
8 z3 N1 p! {; o2 L- |' {rs=stmt.executequery(sqld);
( Z: H3 S$ J8 n# |, ?while(rs.next()); p [$ `9 k1 h5 }& A& D
{: a8 r+ K7 I) L5 f
%>
: o+ [0 |, {. `7 U1 A. k( P6 {) I <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>3 m/ v' z9 h) d7 k& M
<%7 e2 p. h7 P: W& q" \" r
}
4 D9 F4 @0 _' j( @, ~%>
: ~% j4 C# O- @3 j </select>
7 A9 z: \- ~2 [9 d7 [</td>! d1 a. n3 @9 S. C; Y& S. W4 N
<td>
4 Q# Y& c" _& T" l3 I A <select multiple id=city style="width:150;height:200" class="bgc">6 O. c+ b9 M* B% R/ ]
</select>$ P9 o) y" f& n' X H
</td>
9 B% s+ _1 [( V; k <td nowrap align="center" class="bgc">
) F! N. x/ b6 e. O <input type="button" value="<<" class="buttons">+ X; ^( ?1 k0 x
<input type="button" value=">>" class="buttons">
9 L, a3 u; i! A8 Q: h8 X</td>
. G' S" D+ B8 J% M0 U [1 e" X <td>
1 a! w+ O2 j7 I7 A B( F7 _+ |# {6 m <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
' g4 {: O! {4 {8 I0 N& s </select>
, ^1 H. L: ^2 {' D</td>
2 A5 y9 B. D0 A3 Y </tr>
; n3 N/ `1 c4 e% F) B <tr class="bgc">
8 M- I+ p. \2 [; b. V <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
" C" |8 w( g( L% s </tr>( c w2 i; ]$ C% W4 r
</table>( j) J0 [; N. [: N! F
</form>1 \- D0 d" i' Q C3 n' K; u# L: i
<script language="javascript">( Y7 t+ ^/ t& Y2 U1 w! h
//人名移动
# _: x; a ^5 k- f4 o; Xfunction move(fbox, tbox) {
& h. t7 [9 R+ T. }8 Ovar arrfbox = new array();; g6 \) M; t0 S$ W
var arrtbox = new array();9 r8 p' n: w! Z- a# d h
var arrlookup = new array();' M2 J6 I; x& r* i& F1 l
var i;" k6 _0 _* q! e- F; f8 b/ u
for (i = 0; i < tbox.options.length; i++) {
& S7 x' }5 }# z. earrlookup[tbox.options.text] = tbox.options.value;
2 @. W7 B/ K+ Karrtbox = tbox.options.text;
+ T8 d0 S/ @, g: D o9 y. n}5 X; N/ K8 a4 R Q' `* |
var flength = 0;
+ ?" O/ n- H" {6 J# s! Zvar tlength = arrtbox.length;6 l& {( U" P( u$ K U7 Y6 d
for(i = 0; i < fbox.options.length; i++) {
# q; x7 s! I1 t2 p" V, R6 I3 barrlookup[fbox.options.text] = fbox.options.value;
) Y, y4 ~' G0 ~! C! |3 _if (fbox.options.selected && fbox.options.value != "") {
) n2 U" Q0 v/ @* ]arrtbox[tlength] = fbox.options.text;
, H, ]( v7 Z0 m) H1 Otlength++;2 ~( v0 {: r3 p% b
}# K* j0 C* ?/ l# Q. X3 R/ Q' o
else {
7 x& N, J9 d4 ^2 H# Q- `1 xarrfbox[flength] = fbox.options.text;
1 T. a2 a$ W7 I# H& yflength++;0 s& q2 @0 Q9 h' I2 e0 j
}( k1 H9 a# i: G3 G
}
$ z& l1 C* j( S+ xarrfbox.sort();
2 f% I3 k+ _2 Q4 `3 Z5 farrtbox.sort();6 k: f k& K# V9 c- b2 P& y
* W. `( v5 |9 J; {* o" f9 N6 W
fbox.length = 0;1 j7 B/ A- V4 a
tbox.length = 0;
$ e% y7 R. ]/ z. }' f3 `: nvar c;6 ^/ a9 K, y/ {, ^' Y9 x
for(c = 0; c < arrfbox.length; c++) {
: a" r1 h6 d5 l; n1 k. u! Z& cvar no = new option();
1 Y5 c! X" q) K5 w6 C3 rno.value = arrlookup[arrfbox[c]];
* X% R" S0 q- i$ \6 c2 tno.text = arrfbox[c];
1 L4 [0 s7 k) W3 \5 ]fbox[c] = no;
0 u5 T. ~7 n, K) q& j7 l: @}+ G! V; K5 Y' _
for(c = 0; c < arrtbox.length; c++) {7 d: C, q" u/ B ] i; k6 p
var no = new option();. u2 Q, T9 K' u n5 K K, X7 {
no.value = arrlookup[arrtbox[c]]; J; R V! Z4 r! e) E* K
no.text = arrtbox[c];
1 `# g; _& l( E# W/ e0 {tbox[c] = no;6 |% h4 Z& W7 g# [5 b+ \4 ]& O
}" [$ O( F/ T/ z4 n( X1 ?5 P
}8 M0 v# U4 z0 z8 f
</script>9 X& z8 [5 K, |$ u( \
</body>
1 d. B% _" T8 H5 r+ L4 d+ y. ? |
|