  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14159
- 金币
- 2370
- 威望
- 1647
- 贡献
- 1318
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"3 W j2 C1 u6 [+ u0 g8 N
c pageencoding="gb2312". O8 A+ m$ M( f- v
%>
/ ]' C& R- R7 D2 F; ?1 a7 A& A" C<style>
8 C4 g- B. @; y& d% T# p3 J.f9{ font-size:9pt; }
9 Z) X, S2 ?5 G; R. `; Y! j6 c.bgc{ background-color:#aecaf9; color: #0033ff }3 @7 W/ Q5 y4 F& J
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
# n# \, p8 a5 q7 J: @9 t border-bottom: solid 1px #4e7dc1;
# y" n6 d0 j! C3 [) z% ]( J border-left: solid 1px #aecaf9;! R) Z9 a; n# S/ e2 X+ Y) U
border-right: solid 1px #5679bd;2 V$ c- q% \9 c) |/ B
padding:1px;
: S6 `5 ~3 E- G/ h! D' O& Q' `1 _ margin:0px;}& |+ Q) U- o' Q( F1 O4 t M
</style>
$ Z! C( _9 D8 e<script language="javascript">
^& v, }% f- G& S" q<!--
9 j' _8 T2 H& x1 N+ l xfunction rv()
% _; U/ G' y7 ]9 h& p{. l) I4 z2 r5 u
var val="";
- u2 D8 ^* c$ I. {4 l6 f for(i=0;i<combo_box.list2.length;i++){* m9 | ^3 C. K" F4 O' l$ A0 {
val+=","+combo_box.list2.value;/ h# ]$ S' I8 k/ G& v. X
}
8 r V4 S ] E5 @+ Q4 }0 d if(val.charat(0)==","){9 ^! k2 |5 Z2 p4 q/ q6 `9 A
val=val.substr(1,val.length);
/ H. g- [6 u9 ~% u }2 k0 A# H/ t# w* B' k! ^
opener.form1.frecname.value=val;
8 M1 m- b$ [* F* F: v. v, K( b$ B self.close();
5 K- K' }9 m4 S( U# P2 Q}# D' V+ K$ X. V# y5 r
//-->
# E: M7 J: Q# M! q9 x0 A</script>! _& k0 q9 z( p$ [9 a, O9 [2 q. x
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
6 O$ i! U9 y8 {" K9 N8 H<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />. V8 U4 s6 j% r P, g- |
<%
0 J6 Z+ @# X T; T1 K: j2 t cdatasource ds=new cdatasource(); //数据联结bean实例1 J& q7 a+ G2 x( ^
java.sql.connection conn=ds.getconnection();
0 P8 S$ V$ ]9 X3 X java.sql.statement stmt=null;
! u/ J) F0 W( f: x! B java.sql.resultset rs=null;* p# X) Q W9 }5 X5 u* u% B. ~
cdatacheck dc=new cdatacheck();
; j* F a) b, f$ k+ Z, \+ _* l%>
8 }3 ?, Y3 n5 C% e8 H; @<%
1 g; I8 F0 p& r) x# j/ A# Y8 ystring 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";5 a$ C/ X4 r& E6 [# d" g
stmt=conn.createstatement();
4 @) A' _( }. `% U8 @rs=stmt.executequery(sqlu);
* n+ b6 n5 ]5 F" `%>* R* {* [6 | e+ W0 u, }( D2 Z
<script language='javascript'>
% m9 [1 f# H' L- C4 marr = new array();
- w0 ]) q$ s, z8 E; E6 B5 y; T<% int temp=0;/ L/ @- f# S, a( ]# u
while(rs.next())
' _7 M' }- W7 w# W+ j5 c5 N# T1 D{( v4 b% M' z3 y: R; ]2 |! b8 R
%>
4 _" T: r& ~! V- v darr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");) k# u8 E b8 ^; `5 x
<%
3 K- `* ^8 R( }/ B- x @8 g- R: Ttemp = temp + 1;
0 I6 _6 q0 s/ r/ e: r}) I; n$ a9 b8 k& t7 Q8 v1 g7 B* [
%>
" x8 v* F; t% l4 B1 S- k1 g$ f, ^temp=<%=temp%>;
5 b1 {: Z# `4 xfunction changelocation(id){ 5 G- N; f. H( c! K3 U
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
- V7 y. L7 r" m0 Pvar i = 0;
5 a# N, W6 D2 w( s. fdocument.combo_box.city.options[0]=new option('-------','');
( X9 B- ^# q: X. y" @" {for(i=0;i<temp;i++){
4 R5 l- o6 a X; N/ p E5 D: Lif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] ( {) |1 ^9 O: X6 r
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); 1 h- k7 a( { W) x
}
/ M4 \7 C! u0 D7 e# h}
: H$ M0 r" d: z3 B( W2 r} 0 Y( p% A- r2 z
</script>
# P/ o7 ^& q& \7 d+ I+ m
2 ^2 A+ }0 L0 [! }; w' ~<form name="combo_box">% N; k! x+ U2 J6 y4 m# L
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">" f$ l+ i" S2 a; l2 a
<tr height="24">7 ^! s" v2 H2 v. Q" M, y6 O6 M
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>, X; d# a' K2 y/ G& h% M: ]
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>7 P7 h- H4 d" l( m
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
- m0 n& c8 x) V+ ~ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
: p2 D" c1 g- L6 M# m </tr>
1 W+ ?% S h( E' ~( {+ w9 y. d* L <tr> : D1 A( D! i0 Z0 k" S
<td>
9 R- L3 H% t% u* e( \5 o <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
# M: M0 Y; V7 Q' k( J. r8 a <option value="0">请选择部门 ---></option>
: M/ O" c/ X2 O( O( U) M6 D5 d<%' `" S, u5 k' R
string sqld="select * from tdept";
# Z& g7 |" j0 y/ W1 G6 c; I; C0 ystmt=conn.createstatement();
: o+ T# S9 `; m }6 O4 V ?( h2 o9 ^rs=stmt.executequery(sqld);
% Q7 f" N4 u. Dwhile(rs.next())
# `4 Y) Z: o \/ R) I{" B, w$ h' i; C/ {
%>' P# H, @4 d6 ]; b
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
. }. Z: W3 H( H) ^# i6 E8 G# h) U0 k<%; h, |. B" U' ^' t
}
' ~) i( }+ B& Y$ c1 G%> " X2 x+ D" H/ z! i0 u
</select>
6 `* L5 _! w' m2 F- r& n6 l/ N</td>; p8 i. I V: L: P" Q& H
<td># a( _4 p5 O" A! q" n9 H
<select multiple id=city style="width:150;height:200" class="bgc">
' |) r/ B* \% x$ k: l* I </select>5 Y, H) D) l; G
</td>1 |! q: N# z9 s
<td nowrap align="center" class="bgc">1 @- g* K% Y9 ]; T. q" N8 x
<input type="button" value="<<" class="buttons">
( \1 j. t$ `; u- { <input type="button" value=">>" class="buttons">& o% t$ B9 T0 t! t$ W& j. z: ^
</td>
$ U! P7 U: w$ ? <td>
& i7 ^' \: d8 ~$ g" H0 L1 g5 J/ f <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
9 m1 S! V' N. B F. n- R1 t4 a </select>! s* j/ D8 Z2 ?. l/ z. z
</td>
( P. l- R4 B* Y M$ n </tr>
9 [9 V" ]0 K1 m7 u+ z <tr class="bgc"> 6 |* t6 E$ J) l* m' X
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>' T% o, }: L8 [" e6 y+ ^5 C8 e( c( d1 S
</tr># h: J4 Y K+ @( X+ i
</table>
% D7 T% W' Q5 X. ]</form>7 [( j8 L+ e& j1 ]9 Q
<script language="javascript">+ ~* X& u" i9 Q/ X
//人名移动
; A. t0 z: b& E* k! Kfunction move(fbox, tbox) {
1 a5 S7 }. O1 A) v3 |var arrfbox = new array();2 t% S9 x9 @; Z) E$ k
var arrtbox = new array();! a% Q$ h4 `+ z
var arrlookup = new array();+ C" Z! j1 t, B
var i;
0 Y. \# e7 j8 ?. lfor (i = 0; i < tbox.options.length; i++) {( }7 W& @" A; n D+ }
arrlookup[tbox.options.text] = tbox.options.value;1 o# r# k6 S: B* x! W
arrtbox = tbox.options.text;5 k, @* ?& U3 U8 D: C: ?, Y0 k5 {& P* R
}7 \( O/ q! f7 ]2 i% s+ n
var flength = 0;
% n% S5 k+ B( Y. I1 _var tlength = arrtbox.length;
2 O8 i2 q8 m/ J6 f' l" A1 m( L" zfor(i = 0; i < fbox.options.length; i++) {8 _' d* n C! f- {+ O4 n6 ]. x0 C, P
arrlookup[fbox.options.text] = fbox.options.value;
8 q2 c3 N6 A! v R+ a! ]if (fbox.options.selected && fbox.options.value != "") {
: J7 L# m" b" q4 s# Y; E- Sarrtbox[tlength] = fbox.options.text;
t' h" T' K2 L1 I, otlength++;
G* \! W% S1 }8 c$ X: {}
2 A$ u% ?4 ?; x5 O1 c: b& W! h z; Relse {
! z) d2 Y& V+ p: Larrfbox[flength] = fbox.options.text;
3 a% [ X2 Y, g, G6 kflength++;8 r7 ]& ]0 G4 E* T
}
$ T7 r% `. v) P* i5 u7 E9 z}5 h) d2 c+ z5 \7 u
arrfbox.sort();
. ^' a/ D. E4 A: Barrtbox.sort();3 z l/ P$ `. z Q$ L3 G
9 x- y# y! _* b6 f
fbox.length = 0;. K/ \ W5 A0 b; A" ~: }/ Z5 I
tbox.length = 0;
" @9 X; E1 F5 Hvar c;
: m a% E$ W3 p0 n9 s4 r8 B2 nfor(c = 0; c < arrfbox.length; c++) {
: j0 u7 ~+ b. U4 z$ K' \var no = new option(); f% w8 J9 s: f |: F2 e
no.value = arrlookup[arrfbox[c]];
; D. Y3 L3 _0 I4 P5 W1 T4 Xno.text = arrfbox[c];; c r* n+ T' ^0 j. U: d
fbox[c] = no;8 M/ Y' J: @5 F) V* u5 |8 f; A2 f
}& _) q% |9 b- W; d7 k! D& j- F
for(c = 0; c < arrtbox.length; c++) {0 @' S0 @/ M% f; P- `" M' W
var no = new option();
1 D4 h9 G; c0 ^5 `& S+ s* mno.value = arrlookup[arrtbox[c]];) |; s- {" h& I& v6 h
no.text = arrtbox[c];
9 s8 O6 v8 z# T- }! Stbox[c] = no;
" E7 E; i1 p+ W% _/ D& q D }
P& @' u0 L( P" I}
3 ?. X+ x" n$ ^) V) K( x</script>$ ]: `- }2 u' p. O) P
</body>% |1 r9 Y' x* O2 ^5 c
|
|