  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14221
- 金币
- 2401
- 威望
- 1647
- 贡献
- 1349
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
2 V" M* C. r8 l* \1 }! M c pageencoding="gb2312"' Q5 j8 W& O1 Q8 y
%>
* U) ^) U: a, w. \$ B7 _" t<style>
$ Y2 S' l: U" g* ^.f9{ font-size:9pt; }6 w5 w4 r' ] R0 q
.bgc{ background-color:#aecaf9; color: #0033ff }" |+ \/ i! s" ?: D/ l
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;2 p u% u2 s) K
border-bottom: solid 1px #4e7dc1;
0 `" o) o. z- n( E" r border-left: solid 1px #aecaf9;
$ r: p8 b# a S- o4 F border-right: solid 1px #5679bd;
~" n0 i/ D+ I# B- v padding:1px;) o( D1 s0 ]# ]( z$ _
margin:0px;}
8 k# ^3 h7 A, w4 g) d' X7 D</style>
- g d2 g" h/ T$ H<script language="javascript">
" c- S) e) u* j5 _2 | t3 U<!--
( C; W- }' m( B/ J, b/ O1 Nfunction rv()
4 r6 F7 h% C8 A. Q* s{0 K9 `$ C& ?3 V( h x; r
var val="";# k7 ?# x/ M6 P0 j) F1 M/ E
for(i=0;i<combo_box.list2.length;i++){
% }8 t0 {* o: i+ D, T/ s6 C5 Z val+=","+combo_box.list2.value;
& c. t, t3 u% v! F }
n& _* Z! z+ g1 I: C# Y2 g if(val.charat(0)==","){5 r( A3 z) z9 Z+ P9 s- U8 o
val=val.substr(1,val.length);# T; j; G) B a- u/ L
}7 E* M5 ~6 K7 [
opener.form1.frecname.value=val;* U' c/ F" y; q' o7 i
self.close();& A8 Y Y- ^; j9 K( x' F
}
/ K' [2 f& T! s8 V$ _//-->
) O. f4 s# I9 z4 t1 E& }</script>* ]% Y) e0 Q2 d0 n* ]; F
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
4 B. ?0 ?' o# S2 v9 D% f! J<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
# R% x8 }9 K8 i+ k; {' k<%- e- C4 x! L9 e9 h% i D. A; \5 b- w0 @
cdatasource ds=new cdatasource(); //数据联结bean实例
& ^6 L% y, r3 ~5 Q0 t$ i& A java.sql.connection conn=ds.getconnection();; r! o" b! ^/ ?
java.sql.statement stmt=null;
" n( Z+ b! m i/ r! e' J: `/ e: G java.sql.resultset rs=null;
0 [; w$ F! h# H, D6 t' n3 d0 T cdatacheck dc=new cdatacheck();
4 E" X* ^) ~( k%>
- [; q9 }4 ?6 k3 N0 z% ? ]<%; Q6 D) u7 M! i& {* Q% R- z+ R
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";6 c8 E, u) U' h$ c Q! |
stmt=conn.createstatement();
4 I3 v: o; F# i4 Y2 \' X0 b6 mrs=stmt.executequery(sqlu);
0 z; ~" Q/ u+ N3 q%> B# W+ N0 n4 x+ C: L; `
<script language='javascript'>
+ x' N7 Z; D! I6 h/ X, {arr = new array();
$ G' S) |& V' G; e<% int temp=0;0 h! W# q$ M5 f8 {/ N, e$ _
while(rs.next())# ~. }9 P8 n y) M. ~- {8 S/ v
{
% C: Q! a/ i6 n, W6 F' ?%>
( Q, x" ~3 U5 p, Karr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
" S, Q0 B. G' s; R0 Z' F<%: B" c( k# v, |
temp = temp + 1;& y! s" |2 F/ F2 Y
}6 d ?" B9 m8 o4 W& x! T
%>
$ x: O9 X1 ~* Q7 g* r+ P8 x& g2 Stemp=<%=temp%>;
) }% j3 y4 V2 H5 g0 sfunction changelocation(id){ . E) A3 U; ?! [0 c- ?9 i1 `
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
* C( ?% K- p! w0 z% [var i = 0; " O8 u% T5 L# p, t( g" }& I
document.combo_box.city.options[0]=new option('-------','');
7 b# Q, _% E/ M! Y' H6 t- Bfor(i=0;i<temp;i++){
7 ~9 C; b! ?$ Z: w1 R8 Z. Y2 S% mif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
9 ^! }1 H% b+ H1 P5 K# Ydocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); : Z4 [ J, s: X# L# n. Z- L
} ; _# U3 s# u$ o% j# D) \
}
3 K4 r. Y G$ M1 k} . d4 m4 H$ q6 Y- @% B/ V# l
</script>; _9 b( e# | l
3 e5 S( f' l% B6 A7 h! a<form name="combo_box">
8 j7 I! P( w8 o2 w% B<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
; b' s9 n, ]8 q0 m. X+ r <tr height="24">. ^% x0 R3 R3 P7 K1 _2 v
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
1 c3 S: L& p6 O1 f+ ]5 {4 V <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>5 e, ?) e8 N' L3 j, O7 ?
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>& |/ t9 ?" L4 h F& h" l+ f9 m
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>3 G- v- |5 S! s1 J! ^& E/ k+ H
</tr>
" ?( v: V7 O. e V& n <tr> - r+ ~# d9 S8 v0 s& w! d& Q; `
<td>- A2 R1 ^; P# `' V8 t e
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
6 o4 B+ g3 B, l D1 x. Y <option value="0">请选择部门 ---></option>
8 O) T4 d7 K! |5 y( T/ [, E<%
+ i5 K$ |. `- |7 Y* j S- X string sqld="select * from tdept";
% U" x# r5 M3 ?8 i7 `* jstmt=conn.createstatement();
& b: j. K% ?$ frs=stmt.executequery(sqld);
/ o, l# L( i$ B- X0 Vwhile(rs.next())
7 ]. V" h, J' X/ F% b# i{$ |' Z7 z- r4 i1 q# L2 `
%>2 ~$ ~+ S' R% p( M6 f$ \
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>3 }" B+ X1 U5 m$ s
<%
) q: ~4 h4 q( O7 B1 v- V} w9 ]" @: K& r# f) T
%>
/ ? Q2 J; S/ |0 `; Z# L1 E% i </select>
# H, ?$ u- B T+ |</td>
* w& H, ]6 E7 v <td>% C* I% o* U \8 l" j" X, \8 D; }
<select multiple id=city style="width:150;height:200" class="bgc">7 H3 F0 M2 x2 p
</select>$ M) r: c/ Z, U
</td>' Q4 F- y7 K" m( e* |$ g
<td nowrap align="center" class="bgc">: ~+ t! }- e' e, e6 }7 n1 C
<input type="button" value="<<" class="buttons">, p A3 s* o+ K1 Y
<input type="button" value=">>" class="buttons">& g8 |$ q, o/ h0 n1 l$ d, n
</td>( l% |: }+ \1 |3 U" T {! b
<td>
0 ^& _( N0 `' r) x <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">8 a8 t/ A5 V7 ?! n- J: b" o0 ?2 `$ [" G
</select>: Q$ L2 w3 l! x9 X) m# k" Y
</td>
1 i3 \' S# Z# Q+ H- o/ @2 k5 ^ </tr>
' b7 l- J0 T* I+ Q4 |) } F" X <tr class="bgc"> ' s" T: K6 U1 K2 m. [) `4 R% r
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>7 i; j* C3 V9 r' ]" n% D
</tr>) V5 G8 i o4 v5 I3 i1 H1 w3 z/ p Q
</table>: s, U [* k" t. u4 a+ Y
</form>
+ O. L2 s- h5 [<script language="javascript">
# K( b! u6 K, l4 j! {1 t//人名移动: ]: J% I1 ?) n T
function move(fbox, tbox) {% c: ^2 {9 I+ z! ]
var arrfbox = new array();
5 L' G/ s( Y, g" e7 ovar arrtbox = new array();5 x1 t. r9 r1 d8 \) p: c
var arrlookup = new array(); v( d/ K2 e( X9 {& f. X2 K
var i;$ T$ A$ ]0 A7 i; T
for (i = 0; i < tbox.options.length; i++) {
: W! ?( b/ J7 z9 Tarrlookup[tbox.options.text] = tbox.options.value;
# C6 Q0 k1 B- C0 y2 oarrtbox = tbox.options.text;1 N6 N/ j; K; W5 ?0 D; C9 y3 U
}
& C0 r, K6 H+ o/ {var flength = 0;* d1 y( Y2 q8 K" g, F# g) }
var tlength = arrtbox.length;# H* L8 R8 Z) ^4 J. k% _- R* V% u1 Y
for(i = 0; i < fbox.options.length; i++) {. R9 S- }* u# e! ~' |8 g
arrlookup[fbox.options.text] = fbox.options.value;7 n7 j1 d0 c3 g) I; \
if (fbox.options.selected && fbox.options.value != "") {8 }2 q! Y8 `& F& P1 X$ p
arrtbox[tlength] = fbox.options.text;
* j0 M5 y2 {7 x, b( M7 {1 E2 rtlength++;: P3 E& v& m; d. I- l
}6 @, ~+ v" U- G
else {
7 V/ C0 j7 Z! K+ |arrfbox[flength] = fbox.options.text;/ _# \; K) C2 ^ u
flength++;$ v, |' t: P5 X4 P0 Y
}
" U/ ?0 ^' W+ g2 ]* c4 l$ [}2 ? f, ~ ]9 f5 o. U
arrfbox.sort();
$ j: D& O2 \5 U2 A/ E2 {, p0 marrtbox.sort();, I* ^, j4 y+ r, C" `
5 \6 V% W; ~, k3 z! `: G
fbox.length = 0;
3 ?7 j7 d/ M- {2 z% J- i9 Dtbox.length = 0;) e. g7 h9 w& U: t6 X3 B
var c;0 P# z) ^, F/ c7 l
for(c = 0; c < arrfbox.length; c++) {( P; n( O; `1 O# N! g- t# G
var no = new option();
7 t3 x% v3 F4 Y9 d* gno.value = arrlookup[arrfbox[c]];$ R0 e/ h( q E, z4 j
no.text = arrfbox[c];
. R; ?! f/ N! k X$ E' t' afbox[c] = no;4 r# `& h- b* l/ u; k9 n& s+ m
}
9 a! F7 c1 W6 {8 @2 J' A! Z; {for(c = 0; c < arrtbox.length; c++) {) i4 l. V+ N5 H9 Q6 j
var no = new option();5 w( N& d* }& S4 C8 z' k" N0 S
no.value = arrlookup[arrtbox[c]];& G* e6 D( d+ v* i1 X, U1 M
no.text = arrtbox[c];; I6 z& q; |, u3 `' O& B* C
tbox[c] = no;) r6 w( g: Z. A# I
}- v! L' O/ ]8 ?- B9 D, V
}
, Y$ F# i$ p# t- ~</script>
" ]0 [5 ^& q) q</body>9 Q7 q M2 m0 t! x, d$ I; S
|
|