  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14221
- 金币
- 2401
- 威望
- 1647
- 贡献
- 1349
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"7 C/ ^2 r8 G+ [4 v/ M
c pageencoding="gb2312"
" Q+ v0 v. F+ e8 @2 w5 b2 p%>! u3 O) m% B3 L, X0 Y' u8 v' f
<style>
: v8 N4 p* E3 l, q.f9{ font-size:9pt; }5 }$ ?3 G& y/ ?
.bgc{ background-color:#aecaf9; color: #0033ff }
- Q- C: v0 X' }. a8 p.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
8 k; B7 R( b5 \9 V$ G border-bottom: solid 1px #4e7dc1;
- }% c4 b) i# w* y' H, s8 A border-left: solid 1px #aecaf9;( ]+ o3 I$ i1 R
border-right: solid 1px #5679bd;4 V. E. N: X. `+ Q- P/ G' h
padding:1px;) M0 X J `5 c7 R; q# J' @
margin:0px;}- s+ R4 O3 P+ r% N% S1 x
</style>2 ]4 u2 I! k! ^; W+ N* Y$ O9 o% m% q
<script language="javascript">, a2 `- X9 U3 _6 Z; G6 P8 H
<!--! ]$ V0 u4 u* f' {+ l9 V5 Z% l
function rv()5 X8 D) A9 ^: Y* g3 g/ x' V* A
{
$ b3 A2 e2 R9 F* k# \* l o( I var val="";
( q/ f c9 r6 m for(i=0;i<combo_box.list2.length;i++){
0 G" g$ I1 f6 s( Y val+=","+combo_box.list2.value;
- b3 | Y5 D6 t }
1 M4 i* g. d5 s" S# i! l if(val.charat(0)==","){
! m) o0 Q$ Z& o& G' t val=val.substr(1,val.length);
5 y+ n: {) ?5 t }
0 }' ~ P' k2 N% e" y opener.form1.frecname.value=val;
! s4 [5 p4 Z6 ?" k. _# L6 v self.close();
! O, w+ J; f6 G+ \4 e8 M}
' D) E K3 E0 @' _- j9 g3 g) G//-->! ^' Y5 Y6 S+ G& x- w+ ?
</script>4 i: F& N6 f: T: u
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
8 U7 h9 G- \3 |, Q3 [9 W<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
' s4 O* u) E% }6 e* K<%
& Z; C8 ~: ~4 j8 q0 n9 f cdatasource ds=new cdatasource(); //数据联结bean实例
! A. K) y* A L ^; O. t java.sql.connection conn=ds.getconnection();
( c+ w" ]: \7 ^" Q( U- [ java.sql.statement stmt=null;8 e& V) |, M! E7 w5 H/ o1 S
java.sql.resultset rs=null;
0 n8 }# n* s5 B3 y8 l, J cdatacheck dc=new cdatacheck();% i9 r. J3 E V: \0 G1 x! {
%>& e4 M$ `) E9 b( k2 ]7 B$ d
<%, H' ^! M; R$ \4 x9 X
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";2 I+ i# o' D; K* R8 g3 x( m6 T5 u
stmt=conn.createstatement();
& W; l" r8 Q8 ^( e& W# p! b" ^rs=stmt.executequery(sqlu);
_' z9 t; n! G) b" `& E0 S%> ~0 N7 v0 w5 y% i$ @1 u- u! e
<script language='javascript'>- j2 y4 `4 a* X- S. u
arr = new array();
. A; D d% a& j& q/ U<% int temp=0;# p3 G2 ?3 d; i- f
while(rs.next())5 A, O; s' D8 G$ o
{
. B3 a4 X0 u" h5 N%>
8 Y% R7 }# ]3 q, |+ P! d1 J% F/ @arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");& C3 ^* @; q; _
<%
?: n8 \& S$ ?& Wtemp = temp + 1;. a7 {, G) o; M; r5 Q
}: {' @3 f5 n' S2 p9 I
%>: K8 E; P" s, _6 E
temp=<%=temp%>;
5 u0 A8 S. L- N1 p3 O# n Gfunction changelocation(id){ , X8 G8 @& J# j; B% _
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
( ^, f" {( z7 w9 K: Z+ mvar i = 0;
' e8 R ?+ z8 p8 g4 }4 P8 g! k2 Ldocument.combo_box.city.options[0]=new option('-------',''); 2 k: b" a6 \' Q: v v1 h
for(i=0;i<temp;i++){
/ G+ m0 @$ A0 ^if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
3 w8 I L D l% U6 y2 tdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); " r) q5 A; N y8 e
}
8 \$ B% Y( u/ Q' k3 e: E* k& A} 4 Q- y7 Y y3 s0 h1 a2 s- _
} 8 z& {$ D4 |; _" C$ N8 K' G/ C: m
</script>& B# S: s1 c( ?/ H
G+ B: n: v8 C' B# m6 t2 t! G: n
<form name="combo_box">: R8 y3 p! \, m9 Q7 s1 c+ ?
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">1 S, R. H g/ A7 e! [
<tr height="24">" ~: `+ `1 G9 \! z& h' j
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
* q2 X, k+ w W" z% | <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>$ i* d8 R g! f' u, H
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
4 C6 s5 e) p$ d; ]+ n9 x; y3 a <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
/ e2 t! f" G) f% q2 q5 I7 U- v- r% [ </tr>! b* Q" u5 \8 d0 |+ K0 n0 _4 I
<tr>
7 ]! [* K0 E) ] <td>
% a G) l9 M4 I( n. } <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
8 P# m3 ]: c' |) R6 l2 N" p <option value="0">请选择部门 ---></option>
$ j4 s& L& v3 W/ q6 T6 }- v' V% E<%( Q" b4 p% Z0 I+ X# z1 F# x
string sqld="select * from tdept";
* G: y% t9 a6 t0 L* T* vstmt=conn.createstatement();
( ]2 s) b Y7 v2 X. [* P% Z9 krs=stmt.executequery(sqld);
6 y5 M9 T- g( O+ N7 f6 O- f# nwhile(rs.next())
: H" p6 ]5 Q0 f" X# f5 b{' V" b2 R2 Q& Y4 x) y, g# W
%>1 x& c: F& |- `( \4 x7 ? f
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>1 `3 k4 R. L D/ a4 k! K
<%( d$ i8 O% u7 U; H& j; Z- w
}
7 D# s5 p8 \+ i6 s( c/ e%>
; [, k9 k2 N$ x </select>
, j D9 b; M9 T: F7 [0 M& n</td># H5 I8 _, a2 w. q( S9 z
<td>* p+ g: D3 _ y
<select multiple id=city style="width:150;height:200" class="bgc">* T X t6 {) A, |7 |! o
</select>1 F7 r; L, s- C3 K: F
</td>% m3 ]4 Z" c, p1 x
<td nowrap align="center" class="bgc">
9 z" j6 ^" Z0 n1 L. E# k <input type="button" value="<<" class="buttons">* d9 K* Y+ X4 c Q
<input type="button" value=">>" class="buttons">
2 A- z& u( U- r2 f( z/ @9 v& X</td>
9 y# F6 w3 _" G a+ }9 D( Y: p* @ <td>
) T; M+ R# w" G' n( i/ Y$ e5 K <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
+ V7 ^' q5 q& c </select>. @+ p5 W1 a) g
</td>
# t( Z; S: l$ W! {2 J* D </tr>
0 [) i8 B2 _- q: } T3 D1 Z7 [ <tr class="bgc">
' n9 Z" Z, b; L! `# I <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
3 w3 z' E* }4 G1 R! q k7 l </tr>
8 I7 [ ~. n1 [8 N# g/ y</table>
( e; O2 I1 R( N</form>
S$ \! ?; S; h" d* [- a<script language="javascript">
/ T: i7 i& ~8 z$ ~. c m- p2 m//人名移动0 I9 C% H& G" b' C$ d. L
function move(fbox, tbox) {
1 ~6 N/ k7 c' V2 J/ Q$ [var arrfbox = new array();) e" A( u- b. y& p. G
var arrtbox = new array();
" J, F$ ~( r. R$ x% ^- |* |* }( p) `# Gvar arrlookup = new array();! k" [8 g4 @. s& [1 a$ v2 K
var i;$ R+ y' x1 d: o
for (i = 0; i < tbox.options.length; i++) {, v" |2 Q S+ x+ J4 N5 @
arrlookup[tbox.options.text] = tbox.options.value;% \8 n5 f9 ^" c
arrtbox = tbox.options.text;. ~0 L* h' J. c9 |# k* X# d
}* Z' K3 D. O2 [5 }6 j! P' `
var flength = 0;1 y4 d9 m- |, A9 W, ]1 W1 E& e3 L+ O
var tlength = arrtbox.length;
3 O* @1 l+ J6 j3 ~: M9 dfor(i = 0; i < fbox.options.length; i++) {
# G4 o8 N# R1 u6 oarrlookup[fbox.options.text] = fbox.options.value;4 q8 O4 d) ?& ^" M% X X# P( i. O& z4 H
if (fbox.options.selected && fbox.options.value != "") {$ | `. Q9 y0 C, M9 m( i
arrtbox[tlength] = fbox.options.text;
& d! R) N& s. U& ctlength++;
) I- F+ L! M8 n4 ]( `}
$ ~4 B' ~6 o+ e, p" kelse {9 U! p" d/ E6 t! S
arrfbox[flength] = fbox.options.text;
" P) H& b+ ], u( ~, h, Oflength++;9 R, @" O. k- ?. l' p- }
}7 {$ U4 a' j6 A# S6 [6 k3 u1 u
} X4 K0 v3 ^' ]0 s% I; |: p. d$ E
arrfbox.sort();
/ `9 o/ d/ K/ ?# Jarrtbox.sort();! }6 \2 G5 n) l, W
1 C( w4 B4 {- U2 @& K4 @3 ?fbox.length = 0;
* P |$ P) m# ktbox.length = 0;
; T0 Z3 T) e2 f; E% D ?var c;
2 x. w9 x' O; e- R! Vfor(c = 0; c < arrfbox.length; c++) {6 m( A. @; R+ D! q' v
var no = new option();
* r5 ]( C7 A+ A& yno.value = arrlookup[arrfbox[c]];4 v X x7 O9 ]+ ~4 Z5 R, ?5 H
no.text = arrfbox[c];
1 s( T; Y; r8 _, [: R N& tfbox[c] = no;
" T0 }$ J) { e+ e' f' P' ?}
" q0 n1 C0 U- |7 Rfor(c = 0; c < arrtbox.length; c++) {* S5 Q0 |1 j" t
var no = new option();
4 s4 p( l" A( K& Rno.value = arrlookup[arrtbox[c]];
. R* q" y4 X4 v0 G7 H1 n1 Qno.text = arrtbox[c];6 K4 o" d: \: B- }
tbox[c] = no;
3 r* X9 c1 ^( c; F# `2 L7 R }. Y- q. ]0 J* o( y& c' x
}
0 Q- N# g4 W! I0 m</script>& @4 H! _! e6 m+ n1 S9 X
</body>
3 ? I% k8 h, R4 q3 L |
|