  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14189
- 金币
- 2385
- 威望
- 1647
- 贡献
- 1333
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"* R9 S8 c& `% o7 [) Z: w' m z
c pageencoding="gb2312"
2 I/ J5 r$ x4 |' ~3 x- Z3 u1 A%>$ l- z) _& G9 v7 Y! ?
<style>! y" o$ V# Q: T, d1 a
.f9{ font-size:9pt; }3 {+ i) D. a$ M, T
.bgc{ background-color:#aecaf9; color: #0033ff }
4 I( b) U7 m# y T3 j.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;, m' P6 i, L9 S" A' f+ |7 k/ O% K: [/ e
border-bottom: solid 1px #4e7dc1;
F: K, B, B6 P border-left: solid 1px #aecaf9;1 V+ j8 B5 O% C2 C5 R
border-right: solid 1px #5679bd;
( W x$ U" L' \# e0 T3 v padding:1px;
' `: @- \% P2 P- f$ T/ @ margin:0px;}/ z$ U6 ^1 B7 R: y$ L
</style>
2 T$ i2 p/ [ l+ X6 b<script language="javascript">, k0 U5 k+ s, D# Z1 w
<!--, l+ W% D+ a% z1 G( X. C
function rv()
9 H7 k8 x0 o& `" a; n6 o{$ w, z) x- j; B4 V' G
var val="";/ d( k; S7 h8 C8 }- I
for(i=0;i<combo_box.list2.length;i++){, P- p' T! ?+ B3 c2 e5 T
val+=","+combo_box.list2.value;
3 R+ h, U3 R3 P& c$ I }2 p9 c9 b: B) B- a, J
if(val.charat(0)==","){3 p$ b8 T9 Z8 J% V
val=val.substr(1,val.length);1 U+ @ y. G$ X* f3 v$ P
}
% I, p9 c- e5 O% N) d, Z/ W opener.form1.frecname.value=val;" V7 L Z) Q* d0 P1 ^
self.close();1 @! B* H7 t" i; {* Y) C g
}! B$ P. Q0 f+ G! {2 o t, B
//-->
C' Y' K4 I; f</script>1 g, F* }9 ~8 B7 d `* k
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
. w. p4 T- j) N( k" n5 _; [7 B7 m<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
$ P3 f6 [) E5 W<%
6 r) [- z8 _, N0 _% z cdatasource ds=new cdatasource(); //数据联结bean实例: O" H4 O3 l; o) C ~4 `
java.sql.connection conn=ds.getconnection();6 @* e i _2 U; e
java.sql.statement stmt=null;- k1 t! d5 k$ f, ^
java.sql.resultset rs=null;
6 m. [8 h H% o( L5 p cdatacheck dc=new cdatacheck();% N3 t& k6 T: y
%> W! M; u3 l3 H/ e |2 E2 Z& _( v
<%4 V& B+ U9 L5 J
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";
1 c& o0 i4 }0 k$ D8 ustmt=conn.createstatement();- N$ S3 i7 _3 X$ _
rs=stmt.executequery(sqlu);% J* t# X8 [1 B
%>" u/ C2 n2 n3 t/ D4 Q, [; D0 C5 N
<script language='javascript'>, B0 F/ u9 E! |+ L7 O3 S
arr = new array();
+ k3 A1 n$ S9 c0 E<% int temp=0;& M$ X6 y4 f, p4 M" P
while(rs.next())& b+ Y1 f2 o: a5 y g- T n
{
* X4 A2 i" ?. s, _& S%>
8 r1 _* I2 [+ c f; tarr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");- T; w; r: J0 [5 }
<%. j; J. C8 }3 j# p
temp = temp + 1;- R0 T7 j: L0 q5 N3 P
}. }& e5 O2 B* O9 `8 U. b
%>
% }- N4 |3 r0 @: Y1 c5 qtemp=<%=temp%>;
( p# {) b5 I4 o4 F3 Sfunction changelocation(id){ 2 x7 J' n9 k) @
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
0 Q7 T& q1 S& t L, P- _, l% ~var i = 0; . c$ ` _' j! k( z2 {
document.combo_box.city.options[0]=new option('-------',''); ) W/ ?( t6 j3 s- a, x
for(i=0;i<temp;i++){ 6 ~/ l% J, u! H5 _! V& b' I
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
8 r6 K) \* a5 B+ F! H; Q' \7 zdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); " U$ F( C2 Y) m& h
} . p3 Y; C5 t3 l+ R" G# t# {) _
} 4 c, C J$ I* i& w! T+ }
}
: K) i, G9 c Z: @</script>
" ~( x1 J* ]& ^9 N7 Z! b( E g
# j6 m8 i+ F: e" s" E<form name="combo_box">6 f" Z. U Q4 C& d
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
6 d# X' J7 j8 F$ a- J" Z3 S <tr height="24">
4 g' b, [) e: \; S2 ^4 c* f <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>: Y5 a5 _9 C% a
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
7 j: b: \; \( }9 X1 [! Z0 F <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
: O; C: U* a' ] m* _+ g0 Y' {( f <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
4 a% u( H- l/ Z </tr>
& s) s% G3 }- ?' I1 C <tr>
8 H$ [; }; `/ g' X" r% e8 v <td>
5 @$ r1 K1 z7 B9 f# c9 b8 p <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
" K( `& ]' a; W; s3 J7 j! G, g$ u <option value="0">请选择部门 ---></option>+ E; F5 h: |8 S5 W8 H: @; g. m2 G. j
<%. b9 ^6 R; g& U% C; i& W# ]
string sqld="select * from tdept";
2 v2 _/ Q' h) N: a5 ?stmt=conn.createstatement();' `; T2 r' G* B# z' k6 l) ?& ^
rs=stmt.executequery(sqld);" q. V5 j( [/ p) H0 W8 A4 H) C
while(rs.next())
4 p0 P1 n- \0 Z- w9 i' A/ V{
) A) V N/ c- h/ S1 E3 L%>( N4 C: F; G/ t) f) p& Y
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
. w: T( F0 M, g. h<%+ {5 ~4 \" V/ {" V6 S- b
}& w' B' n u5 e+ Z2 L5 u2 P: j. m" q
%>
( L" _& h; I8 o Z </select>
/ M* W* c" P) {7 p! |</td>
6 k/ p; [# R6 p <td>/ ?6 e8 U- J7 P3 F7 v7 \1 Z
<select multiple id=city style="width:150;height:200" class="bgc">
7 W+ ~6 r) ]/ U, q* } </select>
4 r( p/ s$ D% o8 [/ i</td>9 A8 N5 e% b" {( q6 L; d. C
<td nowrap align="center" class="bgc">
* D7 ^7 K2 P+ o: J( \3 o" H <input type="button" value="<<" class="buttons">
% v/ g1 h& D) L6 _ <input type="button" value=">>" class="buttons">4 P0 C n7 d! L$ j9 |% ]+ x, q
</td># Q9 U$ G' c) k/ A$ p( c" I
<td>
' g* d* ^ H4 A$ o1 G. U <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
6 e7 \+ L; r( U: q1 e$ s n </select> D x. v/ y/ H3 _1 ^8 l
</td>8 {- L8 k3 @4 u1 I, C) d$ g
</tr># x' J9 R: M- C) G0 z9 t
<tr class="bgc">
6 b8 Z. {+ U; Z9 q& L <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
0 R/ I+ \8 \/ [6 _- u </tr>! e8 B2 S- F! B4 F2 A
</table>
! {) w! ]& D3 M9 C. N* r G</form>
1 u P" s7 W! U& @# m6 ~) S6 d<script language="javascript">
& y% j* g& N* l, C& m4 N/ I9 x//人名移动
: Z2 g' e0 E, x* c1 hfunction move(fbox, tbox) {3 X& x8 y: B" R& ]- h
var arrfbox = new array();; l. ?+ b& m( [: h& |4 G/ @$ F
var arrtbox = new array();) C8 q+ L+ M; W7 T, d9 }
var arrlookup = new array();1 ~5 _& k$ _6 p2 b% a
var i;
2 d9 |4 ?. P# l; W5 v8 D, Afor (i = 0; i < tbox.options.length; i++) {* ^9 x" G6 Y* I/ l
arrlookup[tbox.options.text] = tbox.options.value;
( C) P' F$ g6 D Larrtbox = tbox.options.text;/ ?8 N! d, ?9 L- `. ^+ M; T" { U
}% I8 J* z* |( V
var flength = 0;1 Y' N0 p; j2 _+ {/ y0 H6 g
var tlength = arrtbox.length;
3 m7 m: R* t5 F/ y1 a4 Cfor(i = 0; i < fbox.options.length; i++) {% k. w3 K0 G* l/ c
arrlookup[fbox.options.text] = fbox.options.value;
( @- `4 a$ y0 i! h! |( Dif (fbox.options.selected && fbox.options.value != "") {
/ v9 t/ b; u/ q' `arrtbox[tlength] = fbox.options.text;7 |- y0 m* m9 m3 \! N
tlength++;& B# N! c2 C5 w" B. \( z# n- I
}; I' X5 m. J* x7 T$ ?5 R, g
else {& k3 q0 e8 C" w; f8 s# R7 B* U) B
arrfbox[flength] = fbox.options.text; W2 w; @, a7 c1 d1 u! E* W+ ]% e6 |
flength++;
. z6 f% P8 N8 Q1 E' X, y$ H }' m/ x8 W( S% I! @
}7 {9 N$ s* D; a n/ e5 D% i
arrfbox.sort();1 u) G; [6 E2 o0 e4 P6 l* s
arrtbox.sort();
/ G- L5 `% B' {& q q
6 G7 u. L% L5 y2 ufbox.length = 0;
e$ ^3 ]' p# P1 j% H) H" mtbox.length = 0;
9 `6 ^( f4 r, H; uvar c;
* P3 Y$ E, \! i" ~, {8 nfor(c = 0; c < arrfbox.length; c++) {
$ {0 _- s- _# J% U6 D7 J4 evar no = new option();
, i) t! @ {& ~& y$ ]# L$ `. x4 Fno.value = arrlookup[arrfbox[c]];
( a* T( p3 b! G/ dno.text = arrfbox[c];
* ^" a# |8 W% v+ a+ afbox[c] = no;0 }/ I3 U, h) A4 q; x3 Q
}" r% b& v2 N0 |" j/ d- g! o
for(c = 0; c < arrtbox.length; c++) {7 U/ c; b" _" ?* V
var no = new option(); Q: u' |, f+ \1 _3 d
no.value = arrlookup[arrtbox[c]];
9 j) H/ `1 f, T$ O- c6 z6 mno.text = arrtbox[c];7 r2 x! U; y. F
tbox[c] = no;
2 @: t! z( @/ c* [7 O. e. } }7 `; V0 i+ \2 `3 _. d0 l! l
}
' s7 A. a8 a* ?" a1 K S$ X2 J</script>. t5 L6 q6 U/ k! Q
</body>+ S: ?; Z2 V9 z5 P7 T5 l+ @
|
|