|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14391
- 金币
- 2481
- 威望
- 1647
- 贡献
- 1429
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"* b' \: S/ |2 H
c pageencoding="gb2312"0 s4 d, _& F$ `$ s4 F' m+ r
%>8 A! y7 P; B: S0 g) {
<style>+ ?% i: n. }8 T* Q4 k5 o
.f9{ font-size:9pt; }
) Y# Z9 c2 E& B1 c# k.bgc{ background-color:#aecaf9; color: #0033ff }
$ Z2 F1 y, d* ^1 r9 i" I.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;7 ~4 R& W" l3 z s
border-bottom: solid 1px #4e7dc1;
K, L( V4 v9 R! g. r6 b7 R2 b$ Y border-left: solid 1px #aecaf9;6 D6 a B0 ?" d! ? P+ L- D4 Z
border-right: solid 1px #5679bd;
" }5 `, W5 I% r% t4 d8 n padding:1px;" M% |5 S* s9 T4 @0 H
margin:0px;}
( b% k) w/ j$ n0 p</style>* f( ]; n, ~4 M: m6 s2 E; }" M
<script language="javascript">3 C5 Q1 `; E2 c. Q
<!--
8 @9 w1 Y- U0 \# P4 W4 [* X. bfunction rv(). d- c( x5 p1 d' n3 L0 _ N
{
+ z$ D4 }; S9 | var val="";
' ^9 w7 g1 |1 i for(i=0;i<combo_box.list2.length;i++){
* @; P6 S/ y' V% B& R) S D Z val+=","+combo_box.list2.value;9 @( L6 {) G1 F2 n/ q
}
7 G8 I6 d/ M# O; x9 b i2 l7 H if(val.charat(0)==","){
4 M; e6 v" ^# w2 Q1 g val=val.substr(1,val.length);0 b1 X: H o: f H9 C
}- u2 R4 j2 ]4 x" `! D# {; {* C
opener.form1.frecname.value=val; I$ j+ R$ r, }% t$ ~/ f2 L5 J% C
self.close();
9 l v9 {" }8 }, K9 x}- c- \# Y/ U5 i2 H5 r! z
//-->+ d4 [; a8 L& V9 M5 C+ {, `2 Z$ u
</script>0 e/ i( E4 @% p1 c
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
% J+ }5 O4 z5 u" h3 c1 Z<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />, \; D* C; { l; E9 l7 r% m
<%: M7 T% P8 K" B. S% ~5 X
cdatasource ds=new cdatasource(); //数据联结bean实例" \& q/ f. O, X N9 A
java.sql.connection conn=ds.getconnection();: h4 f1 p7 ^% M7 q, q) m6 I* r7 |
java.sql.statement stmt=null;8 k- h1 Z4 d8 P( b4 }" h, P
java.sql.resultset rs=null;
; U: X Y) {" r" f cdatacheck dc=new cdatacheck();
7 U* O' |* E1 |" {8 p. l%>
9 p5 K: P2 G* @" o- i$ L9 Q<%
( i/ z; [9 z; Y& E" o5 f# d7 }; |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";$ W* \% n/ A1 d/ O( [2 D
stmt=conn.createstatement();
! a$ l: c, t. s4 e6 d( i+ t) hrs=stmt.executequery(sqlu);6 f6 A( G$ ~7 c/ Z' _ f
%>
* j5 j: H; A( q% t<script language='javascript'>
3 J2 m+ ^4 A, @( F4 X+ ?3 D+ barr = new array(); b4 i6 Z% E* ~8 b, |
<% int temp=0;) `1 b( B7 {$ U
while(rs.next())" \8 ], L% p4 A( W$ Q3 ~
{
) G) C: q5 R3 |! i4 [$ V%>! p) }" N5 j" h& d% z( m
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
! [3 I; q( ]" b$ N0 N& _6 m<%/ S4 U( w( j, u+ V; P$ Z: K/ {
temp = temp + 1; H9 H# K9 s6 _
}+ o3 C& y% A1 _
%>, r. m# ], P- K1 T s; G+ j
temp=<%=temp%>;
6 X2 l6 g! P' d" j4 Z# d) I/ Vfunction changelocation(id){ 1 x, l0 t; v6 k1 }" r0 T% ]# l
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
! A1 |* a, r8 z9 G u1 Rvar i = 0;
. F% S0 k& z- }5 i3 N6 X5 ldocument.combo_box.city.options[0]=new option('-------','');
9 i, z& r; l1 Q) L2 ~: e1 J% xfor(i=0;i<temp;i++){
/ g$ y n: d+ E7 s" v' m) \9 Pif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] 6 v) a* ~! N6 x% c$ L
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); : j/ m+ S! o. n8 B+ O" E( [$ r
} $ U+ P9 T2 B6 T$ ?9 z, u
} 4 s8 r, B* e8 `! ^% ]) b/ j
} / ?' ~* ~. D5 ^7 a% Y9 D' Z
</script>
E& B" ^% m( `2 B; r) b5 o! p! s- Z$ q* ]; U
<form name="combo_box">% O4 W2 X; N% S" N8 K- l2 f
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
) e0 L+ J8 \, g$ |4 j <tr height="24">
4 g) K2 ^! u D" B, }: f3 m <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>( {8 h, k9 j% n2 _- S" c5 X: v) A
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>8 N/ | H, D0 e1 P
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
! n9 W, O: L) r a <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td> v3 y5 [; I4 I& m8 z
</tr>
9 ^* p- V- m9 m, X9 @5 [4 J <tr>
H( c3 x1 u1 z$ W0 N2 ] L# I8 } <td>- a6 L: d* ~0 W* ~2 W
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">2 s) W1 j& b$ j+ m9 D4 U+ S
<option value="0">请选择部门 ---></option>
" i8 I4 }3 ~( U+ D$ @+ Y<%
1 }' g" A2 C9 @ string sqld="select * from tdept";5 _ e0 o; ~ {, E- g' C
stmt=conn.createstatement();
2 D5 B+ S' Z1 A# krs=stmt.executequery(sqld);
% N! S$ {8 T# C, f: n! l' |while(rs.next())6 _3 d! |2 N1 `
{
5 T6 E. `4 D( v%>
3 e# i# [8 J6 ?+ k, ? <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>8 T3 A4 _4 |4 V- F* Q- T2 }
<%
4 k9 k5 Y2 G2 g6 B' V h9 G9 ~. _}( x b- y ]! U8 F. [) o
%>
" ]$ B) S5 D- P% i </select>
$ M+ t7 O. J: v( _$ P2 \</td>
$ `# i+ o( a: b% L# H$ z! e <td>
7 L, ]" e4 v" X4 F; E; b' h <select multiple id=city style="width:150;height:200" class="bgc">
; m* W2 B. U: w# ? </select>7 h ~" f3 o# O7 H. k* a
</td>7 h3 i: l5 e4 G4 K/ a! c
<td nowrap align="center" class="bgc">2 b- U1 l/ ]& O2 I3 c, q
<input type="button" value="<<" class="buttons">
9 W& } J! y4 o& I6 s9 l <input type="button" value=">>" class="buttons">- D3 g, t! u' V7 }. `* m. J' ^
</td>1 u. L4 T l' j# [6 z
<td>
7 i5 l! r6 a/ R* o' U4 Y7 L1 } v <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">" y" V% y6 Q$ v# A" n% ~
</select>" P0 \5 G! b, m0 n. C4 \
</td> M1 x, L g4 z+ t/ x3 }* B! @
</tr>4 n. l9 w* a- }: ]% x
<tr class="bgc">
3 A5 b- f1 F3 q; ?7 q5 n5 X/ p# r <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
" e- }: C3 E$ S* Q </tr>' _/ i1 ]. K5 }9 h
</table>
$ T9 ^& R' l# D4 N/ P2 ~, Y; w</form> g9 C8 g5 t `- v+ U b
<script language="javascript">9 N+ L! V! _& u0 [! f
//人名移动 b: a3 I1 x- f4 O* l
function move(fbox, tbox) {
2 r) e: i: X. [9 J% Nvar arrfbox = new array();
Q: f2 q: z' `- jvar arrtbox = new array();6 D. L8 u% [ A7 _
var arrlookup = new array();9 ~6 f" A( F; `% z8 _ l' a3 |
var i;) L! m- c' H2 ~5 R
for (i = 0; i < tbox.options.length; i++) {) f6 o" q1 n7 S7 \ v
arrlookup[tbox.options.text] = tbox.options.value;# `9 Y7 U+ S! O! c3 R
arrtbox = tbox.options.text;
( R! h; b. R% i}
1 M* }3 {" b. f# ~var flength = 0;- W. v9 c0 p1 _7 `/ S
var tlength = arrtbox.length;
7 K, r2 j+ M0 d4 |for(i = 0; i < fbox.options.length; i++) {
: N" Z% r! B% X' }arrlookup[fbox.options.text] = fbox.options.value;
/ K5 x7 [ J- M- \, X' b% v" Lif (fbox.options.selected && fbox.options.value != "") {
2 g( M) W% J/ {0 J1 Garrtbox[tlength] = fbox.options.text;
0 |( B( M/ a- ^8 ztlength++;$ J; x& h: `6 z; Z" ]
}
+ H" C! [) O. o a+ m( Relse {% [& A! @ I2 _+ D) D6 I
arrfbox[flength] = fbox.options.text;
! B' t/ H# z: [# ?8 dflength++;
+ P8 d6 A5 K" k7 z5 Q }
. |* V& r5 z" e% g6 e}
- l2 p t/ t, @/ ~1 J% ^1 \. jarrfbox.sort();: B. \ V$ W' k( J* }! b8 G- A
arrtbox.sort();
# z. ]% _+ \2 _( m5 o/ v c! p
`8 y$ ?" s6 V0 h+ _fbox.length = 0;/ ~* }5 R+ K6 Y0 l
tbox.length = 0;5 ] g' G: \" y& h( i5 u1 X
var c;/ d: z$ r; _. Z
for(c = 0; c < arrfbox.length; c++) {8 g) R6 H3 I- U) B* _
var no = new option();& v8 z3 F! R6 U# p
no.value = arrlookup[arrfbox[c]];0 I' q5 f: n% {7 H
no.text = arrfbox[c];
* w; D5 z- m3 l; P* ?. C, B1 ufbox[c] = no;
2 e; }0 ~9 l. C! ]8 K}
, v4 `5 k3 h9 j( \* ^for(c = 0; c < arrtbox.length; c++) { C4 r0 ~) r& O1 W
var no = new option();
& J* U2 ~( {* a4 ]2 xno.value = arrlookup[arrtbox[c]];
) m/ Q+ O/ o) J( _. K/ o8 d/ vno.text = arrtbox[c];
5 O8 i5 d8 c) ^/ T5 v) J) Itbox[c] = no;
3 t+ \* Q9 D8 S6 k7 L8 b- ~$ R/ w }
/ q- s) l' l: \" u% t" u1 U6 H}6 O t- t) z+ T8 c! ? B% H
</script>
6 I2 n8 v' u7 n; E</body>
l2 r: O+ \8 D6 r; L+ n2 `8 z |
|