  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14247
- 金币
- 2414
- 威望
- 1647
- 贡献
- 1362
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
* @0 s+ a3 x, G) [( z8 x. f7 n c pageencoding="gb2312"" v* y' M1 P' D B7 T3 t
%>
" R9 k8 S( V& {* D$ V; |& [4 b<style>
5 Q" @! y! c! X& [.f9{ font-size:9pt; }
3 ^3 e( q" t& v: a.bgc{ background-color:#aecaf9; color: #0033ff }
6 A, ^( A2 s! _) T9 n D.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
8 Y1 s) f/ `5 S4 k- E; u% |" e$ K border-bottom: solid 1px #4e7dc1;* l0 M) R/ q8 |8 v$ @& h
border-left: solid 1px #aecaf9;7 F/ @# `4 ?2 d% j
border-right: solid 1px #5679bd;
) t }; S! w+ A' g( h) y% j( K/ V padding:1px;
# }( s! e" x4 h) N' K margin:0px;}
2 R+ ~( _: ?5 ]- |: I! N; ^: K</style>2 P- ?; E( `3 r5 M+ c% b+ X
<script language="javascript">8 M9 k" M9 \- ?2 B* H
<!--
6 b. C! Q b. Y& [( H! \6 Sfunction rv()
& S6 E, b- \0 w8 l{
/ n: k2 w# k7 w2 O& m) s" d+ @* |/ Q var val="";
2 N3 j) `0 K/ b3 t for(i=0;i<combo_box.list2.length;i++){
+ \( W! z' B; `) Z val+=","+combo_box.list2.value;
! h* v' A9 R* F! @& b: D- d }6 n5 [ }7 ?6 a: i8 b4 J h" K
if(val.charat(0)==","){0 `. ^5 D' ]7 o- _
val=val.substr(1,val.length);
' [$ C# L/ c2 r4 u7 j6 n9 G+ B/ w- T }. P$ f2 [2 i1 `' e1 a# f" M# F
opener.form1.frecname.value=val;, m. z* t# `+ ^" ~& S/ ~* J1 k
self.close();; J1 A$ a4 g+ Q
}% x* W6 N2 ?' d8 i( H x: k
//-->9 V y9 `, e: x
</script>5 N# t: e6 Z/ G, P- X4 B
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
6 `) N6 @% g/ R9 T, G7 h" I9 c<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" /> o/ P6 d" V' f0 y
<%
6 I9 h z1 U {. ]5 L cdatasource ds=new cdatasource(); //数据联结bean实例4 ^4 _! C6 P. C% D3 F [
java.sql.connection conn=ds.getconnection();
! h" p+ ^: `! J" c% M java.sql.statement stmt=null;
) c2 n1 `6 d5 x4 u3 p7 A java.sql.resultset rs=null;
9 D9 Q7 l0 Z" _4 S6 Y9 }1 K cdatacheck dc=new cdatacheck();
$ Q6 s+ t5 [% g) z%>" f, k3 n+ A3 x, z
<%
+ @6 h3 L- ?9 _+ gstring 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";
! s6 d) V$ m; l% G' E+ h( Estmt=conn.createstatement();/ S6 @' \/ n+ e0 u
rs=stmt.executequery(sqlu);
, W! V2 G4 u, `( a; u%>5 k- V. e& M1 l& ?, g
<script language='javascript'>
$ Y, B8 O/ G3 @# Harr = new array();
u6 o) ?: A$ |0 B t+ l, F<% int temp=0;2 W" j w; H1 y( v+ D3 c
while(rs.next())
5 j- A( x- r, k" U7 N, h% N{: @- m% J% E" A& G
%>. o) S) a0 b% _- m
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
i/ k9 H, D, K1 v<%# Y/ [6 ~1 ^ W9 `
temp = temp + 1;% t8 K4 c5 r; }' Q# k# P5 A- e9 ?) l
}4 A/ J; i! X" b) ?) i
%>
2 v) j. e% a! {1 m2 A% O+ k3 x. Ctemp=<%=temp%>;
! }4 t7 g% { [function changelocation(id){
2 k5 B6 J4 f Y& S* {document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
8 T. |% b @( I: l' qvar i = 0;
* K/ ]8 s0 y, U: _. ~) x/ M) d. x/ edocument.combo_box.city.options[0]=new option('-------','');
* v6 s" |6 L/ [8 {0 rfor(i=0;i<temp;i++){ 4 _( O* Y7 ~+ A# c3 ^
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] # |2 M1 L7 M0 b6 y
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
6 q) n- U' x0 d$ k}
; t( F* M9 T2 P$ {4 l# `}
. y/ r. h* Q: q( M1 s& ~5 V} 5 V7 t. X" @3 F* W. S9 [
</script>
8 N, V" |$ y' c. u
0 M/ `. [( I) O' _- o1 n<form name="combo_box">
# }& h7 m! D2 ?) s% d7 g<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
5 G+ D! t: c' m) G! l <tr height="24">! B/ W# y" E- E/ D1 w
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
+ Y# }' x# j2 N* j. ~# U9 M, y$ B <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
$ W2 F8 S+ r% a4 p- h* `( j. L <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>: g* ^) _% N: R$ r6 R" s
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
$ B* Z' I* }* T7 T7 S </tr>4 T+ R( M% j$ f& E. s/ B E0 Q
<tr>
$ ^" U9 Z4 \5 _; L <td>' a1 O! d" C6 f: N, t% q# h% X
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">) C f( N, |; _ F
<option value="0">请选择部门 ---></option>
8 ?: V6 s% v7 h" t2 ?! b1 W. J<%
9 h6 H; M" d( \# N+ I string sqld="select * from tdept";
) @! J+ k$ n: K, Ostmt=conn.createstatement();7 ]& W6 x# U2 G0 T4 A1 l# ^4 H3 u/ p
rs=stmt.executequery(sqld);
1 d8 C& Z# R4 N3 S' t/ }- |while(rs.next())
2 r$ ?9 _# ~5 P2 p{8 s) G& U: L( @3 R/ w
%>
0 i* w" N0 O0 f <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
' p+ C) [& r5 r<%
5 d1 q1 w( C$ }5 o% ^}4 X- w4 z' i+ Y I
%>
9 G' ]4 g; V4 q( Q( |, h </select>
) [! F. B1 A4 n7 s</td>% Z6 S: [+ v8 E2 F( n- y
<td>
7 K4 I0 j& u+ t <select multiple id=city style="width:150;height:200" class="bgc">8 N6 ]0 q4 l( s* n# J. Q- O, O
</select>
5 @- o* ?6 ] b2 n; q1 ~+ y6 h, C</td>
$ ^6 t0 y% H% b <td nowrap align="center" class="bgc">6 N, Q2 O) F o, e6 Z
<input type="button" value="<<" class="buttons">1 \& `$ v& Y3 }$ R6 X! b( Q( P
<input type="button" value=">>" class="buttons">2 [1 J) u1 {6 A- D. S5 V; u2 u
</td>- p/ U% s+ `5 N. h
<td>0 @7 F, |5 F9 {' k% U
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
# x2 @2 D I8 p" I </select>) N2 B# E- ?/ N( \1 N
</td>3 r5 j6 R, Q* y
</tr>3 m# Q P6 n1 r4 r# n' r
<tr class="bgc">
1 F3 |1 p; H& N& G! L <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
3 S% |. m+ a0 p8 R </tr> e; Z$ q4 Q' O& [
</table>
/ ~% I7 Z* ] y, C5 T3 M) c B: l' S</form>5 X& M2 z, c/ d' S- i
<script language="javascript">* P( A [# U& y( v4 j
//人名移动
) ^& @; |" s6 vfunction move(fbox, tbox) {7 @. J: h% F% r" `
var arrfbox = new array();+ t: r6 H s$ U( s
var arrtbox = new array();! M0 C$ y& Z- x' Z3 O9 {8 u
var arrlookup = new array();' n# B. r" K7 A' g
var i;' X1 R9 [+ X2 J# m0 C; @3 o
for (i = 0; i < tbox.options.length; i++) {
$ W0 v4 p1 V1 tarrlookup[tbox.options.text] = tbox.options.value;
# e3 E/ \0 D1 o0 T6 U2 k, |arrtbox = tbox.options.text;' F- j O7 N. {0 @1 ~6 d
}' ~) j4 x' Q4 m: H+ O
var flength = 0;
9 @5 ?! _' N' y/ z% m8 m: H: D, E& z1 Avar tlength = arrtbox.length;$ T9 L; z1 s1 Z4 o: D* z
for(i = 0; i < fbox.options.length; i++) {4 u7 q9 s% M) ]' }& H
arrlookup[fbox.options.text] = fbox.options.value;
" f3 L7 Q. D# i& H- ]$ u. M+ Cif (fbox.options.selected && fbox.options.value != "") {2 L, ^0 o. K0 ~- D/ H! g
arrtbox[tlength] = fbox.options.text;
1 }6 X2 |' x' b1 |* rtlength++;
3 T% E3 Q$ c' Z' Y}6 \! A6 }4 o) `5 x/ z* E6 C& a b
else {* l0 ~2 K) d$ w9 ^ |0 L0 b
arrfbox[flength] = fbox.options.text;
! X% c& G6 K- [' C& dflength++;! q0 {. }" i$ U4 _
}" Y, p, e/ C: ?% p
} S" x% b) o; y* j
arrfbox.sort();4 w$ P8 T; a# m
arrtbox.sort();+ P8 @8 Y+ X' [- d0 P8 }# E* {4 w
8 ~0 n7 C" ~. T& N
fbox.length = 0;& e2 R* R- t9 e! j
tbox.length = 0;
$ v" r' w H5 ]4 mvar c;1 I! s C! ?! h/ |- E0 s9 T
for(c = 0; c < arrfbox.length; c++) {
& X$ s8 j7 l! @9 n# {% i/ Uvar no = new option();! k! S) }1 e5 H$ e9 r
no.value = arrlookup[arrfbox[c]];. x3 P1 a* B3 C( Y2 G# x2 g
no.text = arrfbox[c];
5 r M- y# m! U7 Sfbox[c] = no;
k2 w6 Y4 I7 Y0 w} ~% e! q& ?; v
for(c = 0; c < arrtbox.length; c++) {" v% j/ \: T' _2 o+ z
var no = new option();
1 ?, B' b, n( Jno.value = arrlookup[arrtbox[c]];# j8 T/ l9 X4 L8 f! j6 X- t0 E/ i
no.text = arrtbox[c];
4 c% H0 p$ O* h/ Xtbox[c] = no;
3 A5 {7 m, Z2 w }
4 y) q2 Q) z n" G# X3 J4 D* O$ I}" r. U7 R L( ^# m" L: ^3 p
</script>' _$ ^4 E/ v! l' T
</body>
; w! V/ \4 m# s4 p; \' K |
|