  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14191
- 金币
- 2386
- 威望
- 1647
- 贡献
- 1334
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"! V) Q( _" F I% J
c pageencoding="gb2312"
, a6 j; g e7 H& v" [- T%>/ g9 B# ?$ g+ [
<style>
: x# W& W( J4 g. E+ p0 k.f9{ font-size:9pt; }, f- x0 b1 S7 m2 c5 j/ w' _8 ]
.bgc{ background-color:#aecaf9; color: #0033ff }
0 m7 ~$ A& |, H0 f* Y3 e! ^.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
b6 Z0 B: z n7 E border-bottom: solid 1px #4e7dc1; U% H' L' \- F# q9 R2 I
border-left: solid 1px #aecaf9;$ e/ @/ ?3 ` E- S4 t
border-right: solid 1px #5679bd;$ R2 y4 u) S& ~( y) e, Y$ C
padding:1px;) L# E$ R, f, |$ Q
margin:0px;}! a6 W, @" \, m" \
</style>
, M( ^( l) V. J# w9 B" E3 }<script language="javascript">1 W6 }9 _' V0 ~& j) ]8 W1 l4 E
<!--; W5 p9 M3 O& o& n8 O
function rv()
* R* ]6 P1 Y4 V9 `* r1 @* i{! e! ~. P( x/ G& m) r5 A
var val="";
1 S7 O8 u7 J7 }$ m5 a9 C. X for(i=0;i<combo_box.list2.length;i++){# ]1 Q5 P9 {' h) w# n( }2 _+ A
val+=","+combo_box.list2.value;) a2 t7 W; o( |/ \0 ~7 W' I4 z
}
6 N8 ` D7 M- z/ G4 |9 x if(val.charat(0)==","){" d# `& x, P/ }
val=val.substr(1,val.length);
) D! S) q1 A7 p8 ?( z. X }' k) k* ~1 j8 E: D* c' I
opener.form1.frecname.value=val;
+ E+ ^' T: I, b j" G self.close();2 L% k9 A/ J" v: i+ `. \3 l
}
. q' Y3 w# c6 U1 u6 g( h//-->; T6 N2 u' A5 B- \2 L/ D
</script>5 G1 N& H* N2 v f. h# {" G& _
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">% m8 S y1 x! N
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
- w+ }7 n0 B% H+ z$ J<%" ^" U, `) }" `0 p" D
cdatasource ds=new cdatasource(); //数据联结bean实例, V# I0 u* w+ {# B0 q( T W
java.sql.connection conn=ds.getconnection();& ?! J8 R& o; |* \1 G2 x
java.sql.statement stmt=null;
) l {. X1 }6 O5 A4 Y java.sql.resultset rs=null;+ ^8 d8 Y' W# _1 ^" K# U( N
cdatacheck dc=new cdatacheck();
! B4 C+ v4 g: h5 n! U%>
' Z n# D1 C+ V<%# l' O% }/ K* _8 h
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";- K: X i/ H* ~" v
stmt=conn.createstatement();
w, i; F( R" t3 I% nrs=stmt.executequery(sqlu);' }' p( z8 |# q) T: t
%>, M0 }0 G: [, K
<script language='javascript'>
" G/ R- U0 m, B! G( r3 N; d) karr = new array();
1 k( W. G) K0 v- d1 E<% int temp=0;- D' h: G. W" ? m* F* G
while(rs.next())1 g( [9 x: P: p5 k
{
$ \ s9 r' y% i2 w3 d4 U%>- |# L& G+ s* G3 q) u' g" X
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");0 P2 g% q5 I8 X6 n( E) B/ m( J
<%
9 z1 l$ ~( P( y/ N9 T2 O M; Ctemp = temp + 1;
- c/ a8 y$ B$ R0 {1 m# R. f}' A1 \5 W* X0 c, O+ d
%>
. ]. @$ w, s0 M) W; r: ftemp=<%=temp%>;
; R* ?8 m8 f4 c3 Q9 z! wfunction changelocation(id){
! m" i/ I; t& N0 m+ T( l6 Q% udocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 ' _: G3 b( Y7 x( V3 d
var i = 0; 1 r' B! b% a. a7 ^, T
document.combo_box.city.options[0]=new option('-------','');
5 |. t; e# n% L3 Lfor(i=0;i<temp;i++){
- n9 U0 `7 D# ]5 R, c( ~if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] " b$ `/ G& E4 ?
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
9 p0 |, h+ ?- B} " j" R5 Z ?$ J7 r, u" f+ ~
}
, B3 @& J" S3 S}
_& z0 y+ i. w! ]7 H1 ^' k</script>
X! k# l1 g* L, {; T# a9 n
4 {8 c5 H8 {8 ]9 R- r6 _* `<form name="combo_box">
2 T- U m# g X<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">: q; z. T# k- W. _4 m
<tr height="24">! G+ X' h0 c8 V8 I
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
/ E5 ^# Q! I V. {! ] <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
) l7 q; e2 D- Z8 e2 p+ U; w+ b: U <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>& u- t$ T" @( n
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>8 j/ w6 N# D% ?* q+ T8 \
</tr>
. B/ y2 f( `! w$ S8 @- x) w. v <tr> ; ?2 C+ u9 K7 l3 z& M1 T
<td>
8 f3 I. {2 S5 m) f$ c6 r <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
3 a' K5 X( ]9 `, K, X( N: Z3 [ <option value="0">请选择部门 ---></option># c/ h2 V4 o* y2 H$ D
<%
4 r% n2 u+ {; v8 o6 s, m$ d string sqld="select * from tdept";
6 |+ w9 A6 {3 M$ tstmt=conn.createstatement(); H7 ^7 |: {* E6 p
rs=stmt.executequery(sqld);
& R" M/ S% | C1 _! N) jwhile(rs.next())
6 F* S, e4 i5 Y' Y$ b{7 ^2 e- T V; b' D& q, s
%>5 Q6 B" e5 T. e& S' m5 d
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
# w. i9 Q# T5 K+ O8 c6 |6 U<%
: g( s( p! I5 Y0 ^' ^}: M0 ^7 j! w, Z6 Q' q' G2 Y. W
%>
; Z8 n4 k2 n7 E. k0 G1 V' ^ </select>
! M" V7 t/ Q& _2 D! ^</td>. T' N0 b& Y; X8 m( g t: t! |9 Z
<td>% Y8 ~. C( O. K* _+ Y5 S; z
<select multiple id=city style="width:150;height:200" class="bgc">1 f: Z% Q6 C3 ]* g' A# N7 m2 ~! J
</select>9 b: ?* p5 w& h. n: I+ s% F. n
</td>/ _; G7 n9 b( G8 o U s: q8 ]
<td nowrap align="center" class="bgc">
. S: k* b4 N1 n {: H" R <input type="button" value="<<" class="buttons">( N/ u8 `* d; R, @/ U4 o2 s
<input type="button" value=">>" class="buttons">
( b( u/ m, Z6 C4 M/ f</td>
5 D7 ^! ]& Z, h3 i( ^+ P- s <td>. E0 |7 e5 D. V
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
8 U$ B8 f5 d4 N$ _ i/ x </select>& R1 |6 J6 m+ h; i
</td>" K* v, }8 b1 A! s7 Y+ s
</tr>- Z7 y7 J6 H0 U
<tr class="bgc"> ! m% \% j; K' k
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
/ K3 |, t0 G& p2 W U, M7 N) f </tr>8 j7 B6 w+ e$ z! ^' T) H
</table>. f+ i }( p2 a$ Z
</form>3 `- n- E+ N. l, a' a2 s
<script language="javascript"># o E" Y) r0 R9 R4 Y, T5 S% l% d
//人名移动
+ b/ I* w% k: Z* D$ l7 {function move(fbox, tbox) {
' a9 P( c( `' \. Svar arrfbox = new array();
& T. T& u" ?7 ?) d# }! jvar arrtbox = new array();
7 }% C3 t! T$ ~# c( L# g2 @# nvar arrlookup = new array();1 Z% f" |( f* @
var i;
6 x& x9 a ^5 R- N) efor (i = 0; i < tbox.options.length; i++) {
6 t5 F6 L5 |$ v1 h' sarrlookup[tbox.options.text] = tbox.options.value;" w! ~4 G- G" ^ T9 F/ M
arrtbox = tbox.options.text;
, f: M6 C5 I( ?: A! X+ s8 ^}
8 ?# v. X V$ V5 J+ R/ ~6 p; ivar flength = 0;
. ~: h3 R, z. N8 s# D& l, `, avar tlength = arrtbox.length;$ W& t5 X) k1 l
for(i = 0; i < fbox.options.length; i++) {( l) z C7 a3 x
arrlookup[fbox.options.text] = fbox.options.value;
& j3 m) ]$ v% _4 Hif (fbox.options.selected && fbox.options.value != "") {" l' Y4 ^+ x9 P; `: `
arrtbox[tlength] = fbox.options.text;% O- `+ [+ E; z5 O% B7 |
tlength++;" S/ i& j( s7 F" _: F3 ]+ t& ~
}
$ t" e6 }0 ^( _5 u/ y* s! m5 Y6 `- ?; ?else {2 a; o0 r7 p* l2 C$ @3 P# z5 e
arrfbox[flength] = fbox.options.text;
* e3 k6 m* B: ?! kflength++;8 p' F. q' \% j" g4 [- |) {
}
9 k: g/ L) q, {, X% |}3 O( Q1 y2 |# I6 v! ^# u& [
arrfbox.sort();
$ D' g, \/ [* n4 v& Yarrtbox.sort();
2 R" P# B( o, r
1 [0 k$ |* o" q6 `) W" dfbox.length = 0;* n' q% x* a# Y8 ^# A' W
tbox.length = 0;
" N( G7 ~! D$ X" u7 ovar c;
' ?3 d# ^8 W u5 Gfor(c = 0; c < arrfbox.length; c++) {
6 {3 L( `1 D2 W: U2 H2 y' D rvar no = new option();
, D# s# c- K/ z2 j8 |5 p; ]no.value = arrlookup[arrfbox[c]];
+ J$ f% q j4 p# J0 Cno.text = arrfbox[c];% y) s) u* b* c8 F. t
fbox[c] = no;4 v- p7 l! L/ B3 ~1 N7 w# d7 A7 Y
}
- v4 Z$ b1 s& Q. i" Ufor(c = 0; c < arrtbox.length; c++) {
Y# m$ o+ l% P- |! O6 S" A m, evar no = new option();
0 k) E! _# a8 C. u" M$ G5 tno.value = arrlookup[arrtbox[c]];3 M* e( Q" g! v* Q
no.text = arrtbox[c];( z* b2 A; Z' T! [ E
tbox[c] = no;+ K' |: q8 {# d
}
! r2 {" Y) W% h' b4 x; n, o- V) r. s} [/ @4 _3 n' U
</script>
5 _, z, @, l. ~# ^9 B9 z* G! C</body>
; S$ _1 R5 m3 @* Y4 ]: p |
|