|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14351
- 金币
- 2461
- 威望
- 1647
- 贡献
- 1409
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
7 J2 J4 `& G* A; a( E" V2 ^2 G c pageencoding="gb2312". F" i2 W; U. x' g( c
%>3 |* X s# T4 |+ y9 j" w
<style>
( R% z) X" \- \5 V4 u.f9{ font-size:9pt; }8 O! V! B& n+ F7 B
.bgc{ background-color:#aecaf9; color: #0033ff }) H. t7 j, Z& g' c
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb; V* s/ ~% c w& r' a1 @! y0 q
border-bottom: solid 1px #4e7dc1;. T1 Q3 `0 r/ J% b: w6 H
border-left: solid 1px #aecaf9;$ J" C; [3 F' _( v# w- y) W
border-right: solid 1px #5679bd;
]- F; E9 j4 H+ m padding:1px;
' `, [ m$ O% v1 S7 A9 } margin:0px;}
! q- ]* c5 d( f</style>" i4 w4 e# b6 H3 ?+ n6 w
<script language="javascript"> I; B( h9 m; \7 s/ K
<!--, ]5 W$ V6 g9 m
function rv()
~) [5 N Z1 c$ e: y5 _& }" b8 Y{
) M' y; D$ g' |. d var val="";
' [, v: c' J4 f. Y! n: b: Z for(i=0;i<combo_box.list2.length;i++){; c: Q0 T2 d( a- p: n: i: }
val+=","+combo_box.list2.value;. {8 k/ |4 s, H' M7 ?
} |3 i U& T: |) s2 c0 d5 \" i1 a/ Z
if(val.charat(0)==","){' i V" k6 T9 R5 l3 D( q7 L) V& K
val=val.substr(1,val.length);
/ W4 T" R6 z5 m& G( j9 |4 {" \( g- m1 w }
2 i L3 _: {7 [ _$ c6 d opener.form1.frecname.value=val;
, v* H2 T5 U( R+ u! x4 D self.close();2 F* K; A' ^$ R' o
}
4 n' I+ h2 w& s' m//-->
: x5 x" k/ _$ C, ]6 D. o( z</script>1 N/ Z6 P- w5 F. F+ b! y v
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">- E) H! z0 U0 ~8 ]6 d4 b: v( V
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />2 R6 l( S) n8 i" l6 P3 R! v
<%9 L/ K- t" ]9 ]* S: G3 e7 U
cdatasource ds=new cdatasource(); //数据联结bean实例
* [; e& ~2 e+ J/ z java.sql.connection conn=ds.getconnection();
* W& M9 D" S" M5 v# B java.sql.statement stmt=null;
+ H, c5 E( u: R+ d1 Y7 O: V) l8 E java.sql.resultset rs=null;6 G$ l8 S6 D+ K) Z4 {
cdatacheck dc=new cdatacheck();9 r+ Q, ^- O, ~
%>
; w* j0 G3 _. U<%. i) I* Q: x+ A1 R. u5 A2 P7 C
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";$ N x2 l- T- ]7 K3 a8 S
stmt=conn.createstatement();) c. ?" B0 J: }
rs=stmt.executequery(sqlu);1 M1 y f1 y) ?' t6 i: P# e
%>+ U& d0 I% G" B* i O& `
<script language='javascript'>9 e7 B4 e( n3 z; B) O/ z+ ]
arr = new array();( q# M4 b- ~4 ~1 h2 A5 E6 P2 h J+ |
<% int temp=0;
* x2 W% L3 u8 K6 x5 L9 Gwhile(rs.next())
: z5 o' W8 d0 n+ M H2 T3 n- y{
6 h; h+ b6 t4 D$ `& P" M3 e* J) [%>2 L+ p1 j, _3 z4 g+ ?
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");* x; [4 `3 r, b( d# f' q8 D6 B
<%6 F, |" |7 J. P* W
temp = temp + 1;
5 Q/ m; z% w9 l6 r# i5 Z% B}
9 V+ |0 v3 \/ W x4 T( \%>
4 l e2 {5 [. wtemp=<%=temp%>;* [" E' m3 E" e2 g; ]+ f1 H& e
function changelocation(id){
G. D5 S' g# d4 i# wdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 / F2 c* W" a! P3 C- p* E- Z
var i = 0;
1 f2 y1 y2 L, _( X/ U+ g9 pdocument.combo_box.city.options[0]=new option('-------','');
; R5 _+ D3 I, Y$ k# X. L' dfor(i=0;i<temp;i++){
3 P( ?4 \/ H5 [% }0 c" wif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
0 k, ^1 I" V' ~8 N5 `$ U2 Tdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); ' L3 C. J, N- M* A
}
) O* o7 i1 W* _0 m4 I. O}
9 f: ?9 G! m1 y+ e% K} ( l7 y r) ` V6 Q
</script>
) o# S$ j5 X" ]: K$ g5 d; |( ` G* z: k7 v
<form name="combo_box">
3 Y! [, Y4 r5 o<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">1 P# D( C Q- v d: D) u0 c
<tr height="24">: l& ]) L% Q( ]7 D' C
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>2 w" u7 [! j! o. ]3 ?' B% ^7 M
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>" M8 [& ^! G2 _$ b
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>1 H6 i: U, M- c0 x; O$ C8 q' [+ v
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
+ l% ?/ C# q6 ]+ H </tr>
" o; k% L5 B% X <tr>
, X3 R2 M2 R9 u5 J" Y& @ <td>
; a: n) K4 b% t [2 w <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">$ J0 v' ] b, L3 y6 S: ]
<option value="0">请选择部门 ---></option>, B, `0 Q! K- e; o {6 X
<%- F5 w5 V' {* ?3 j; h/ z+ K
string sqld="select * from tdept";
- g6 v# n6 A) j& [6 I2 Bstmt=conn.createstatement();; l/ D' o6 }& z3 R
rs=stmt.executequery(sqld);3 f! t* R+ t% o& V# q) d; M
while(rs.next())
, d# P. @& g8 y+ @5 J6 J& h$ ~{
% m4 A: P9 q* t0 `0 n%>9 k8 ]" Y: {$ v' j, _% H Y5 E
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>6 m2 e" {0 `0 `% o% q% q3 S
<%5 g& R) l* T% |
}, Y( y( l' u, l) \ L! X4 R
%>
0 [6 v% I- n, `" H$ r" R$ `' R6 } </select>
& W" q! K( w {' i; J' Y4 [</td>
- q5 k3 |' w! t* M' } <td>
1 c* z7 @' o- J- t: _* d. C- _! Y <select multiple id=city style="width:150;height:200" class="bgc">
' a& O9 J! ]$ } </select>
2 `3 ~" V* T q4 b3 z</td>
8 f+ z# M9 c4 \% i <td nowrap align="center" class="bgc">' Q' c% _ z' u: H
<input type="button" value="<<" class="buttons">
# ]& N) _8 P5 K3 T4 _# u; Z9 f <input type="button" value=">>" class="buttons">& L) N2 D9 g" R% \5 h1 e6 y
</td>
# v6 M/ v; ?" U- b* H# U8 k& g( ~0 g: A <td>
) d; {+ l, x9 R$ A; h <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
# l2 X* N+ U5 D) ]7 Q </select>
: j- A2 u% j. t+ [3 D; [</td>
7 d0 w& j$ h; P( `3 f </tr>4 |6 `& a+ p- t ?6 [
<tr class="bgc"> 0 e: E3 |* }; X6 G; k2 d) ]
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
% V3 Y r7 O# T# p1 X </tr>: z" T3 S) Z4 x& h; X
</table>
6 N5 z* p8 U6 C5 ^9 t: u7 Y+ _</form>
* d3 ` [1 I' O% X- X, J<script language="javascript">
+ `8 k; |& l; ?4 N/ h0 ~//人名移动& j" l* E0 Z/ y( P8 f; P& g5 A# j
function move(fbox, tbox) {- @6 }. B* Y3 y. b
var arrfbox = new array();
2 c9 n% j. @. O5 ]8 \+ D1 F' yvar arrtbox = new array();+ V) e0 O' i0 \ a# O- Y
var arrlookup = new array();
- l, F; D' o; P/ Q; i7 x% |- fvar i;& B8 i: t* }. f- J/ p
for (i = 0; i < tbox.options.length; i++) {
# \1 P2 A, b. t$ earrlookup[tbox.options.text] = tbox.options.value;) k5 ~* A0 X( r' q6 ^
arrtbox = tbox.options.text;0 Z$ g8 ]; }+ }0 Z3 w& K- J: T
}/ C- b: f: Z* @" L; E; F
var flength = 0;% s, ]6 o* W. C' `9 e* J
var tlength = arrtbox.length;
5 K, F( H5 Q2 \! E% l7 t; O& _8 G ifor(i = 0; i < fbox.options.length; i++) {
) _* M, y" f1 h" b. sarrlookup[fbox.options.text] = fbox.options.value;
4 T8 P; s: n& Z, Z7 nif (fbox.options.selected && fbox.options.value != "") {9 d3 [6 F: o2 C
arrtbox[tlength] = fbox.options.text;
4 G0 o. i# H$ N! k5 |tlength++;
* t' S& w' O: g+ m}' x4 Y4 i, ?/ Y! R. J8 v/ y
else {
+ r' F- H6 K( t8 }! v# Carrfbox[flength] = fbox.options.text;
9 K3 L3 z3 c* T, `, Jflength++;
2 z1 @- u' O7 X }: K* \7 X2 _. U8 n0 S3 o
}
$ ^) \! q2 a. G% n% L: H% k' Larrfbox.sort();) J2 q+ d/ X6 D% \- Y2 D
arrtbox.sort();
~; K* j/ H1 J) F8 D) c7 i j& S0 I# L3 d2 _) |
fbox.length = 0;
5 l6 [& K( w+ Ftbox.length = 0;
w( j0 L- t, u; K/ X# m7 `var c;# o" X8 v0 B! O* a
for(c = 0; c < arrfbox.length; c++) {6 H Z/ w- r9 v9 s% p$ \$ M0 \1 J" W
var no = new option();
~) E8 `/ b5 l0 Pno.value = arrlookup[arrfbox[c]];. u4 \" s: H* a" B$ |4 v
no.text = arrfbox[c];3 {4 b' k, S2 j1 ] ?* Y" a& @
fbox[c] = no;
8 X! O3 U8 R/ R1 N& M}# I0 K' ?# b. B3 n
for(c = 0; c < arrtbox.length; c++) {/ J9 W" E! p- p- j* w
var no = new option();" d1 K" F' K5 K; n$ l
no.value = arrlookup[arrtbox[c]];
: T& u. g# M& ]" F; s$ ]. e9 Dno.text = arrtbox[c];+ I0 _- ?; }- s8 g4 K3 u
tbox[c] = no;
5 i! Q0 }! i0 f1 R8 \ }
* L9 l+ |: \/ `7 P}6 o5 L, H3 P& w: r+ k
</script>5 H+ p! `2 W0 U' N7 K
</body>$ h5 r& @" F; n$ j% a3 p
|
|