|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14447
- 金币
- 2509
- 威望
- 1647
- 贡献
- 1457
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
& G% U; c1 ^2 N9 |* t c pageencoding="gb2312"
3 @$ V5 h* b" I, l6 K# C. {7 U( b%>
! ]! M; }4 [( v% T& | ]& \<style>0 r p# Z* C# J" H; A9 w. ^! e9 G
.f9{ font-size:9pt; }
6 z7 M Z% X6 s8 `, Q2 o1 X5 Z.bgc{ background-color:#aecaf9; color: #0033ff }
+ Y$ k! N3 C1 H9 B4 L4 S7 ?.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;- b! [7 E% c0 B* ?
border-bottom: solid 1px #4e7dc1;7 ?3 J, j! R/ x( m
border-left: solid 1px #aecaf9;8 Y( V2 n. x1 K4 D
border-right: solid 1px #5679bd;
1 U' T1 I* X" H4 e6 ] padding:1px;
7 o& o8 _" [$ I" t) N margin:0px;}
8 G3 @: o; v' q" m3 k. t</style>* ?; B6 O( \, p
<script language="javascript">
6 P; P, ?. S- S& I# M<!--
2 u+ H2 l4 a# E0 Yfunction rv()
9 L/ ]% Y8 T X8 }! |) S# Q# ]{
# D* j# J% j6 o1 p var val="";6 z$ u6 u8 j) x7 k
for(i=0;i<combo_box.list2.length;i++){. L6 D1 w5 J* {3 M1 K1 ?. v
val+=","+combo_box.list2.value;; r! G8 g5 n3 D1 O$ @
}$ f4 i/ S, d+ Z) a7 r/ i% B( r4 y
if(val.charat(0)==","){5 |3 u9 z# O) d, y
val=val.substr(1,val.length);
/ t+ U$ I! I& E$ |0 U! `6 b% Q }
1 o$ i) ~. m8 O1 { v. r2 P opener.form1.frecname.value=val;
: ]0 z6 Y# R' t( n: D9 `8 |) B& B self.close();. u: C; L" V, M. q+ P9 w- Q
}( |7 J% `* k& N
//-->6 Y# S2 M1 f1 b% o
</script>9 G9 W2 P) _* A. X* m* `. q# D: Y
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">. a" A) J& b) N8 Q; L# K2 K4 _
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
" @+ U' \& T. @<%+ D" w6 _' z. M, ]) v
cdatasource ds=new cdatasource(); //数据联结bean实例, P+ x, E* @# g' c
java.sql.connection conn=ds.getconnection();
" p. z+ o) J* {& {% \/ W java.sql.statement stmt=null;/ A, K- C* b8 Z. q& A$ M, \
java.sql.resultset rs=null;& ~$ O* M; ^! |
cdatacheck dc=new cdatacheck();
! d5 Z. {# @4 }3 |4 M%>
" a: e7 U2 J0 R k3 g<%* ~ h0 {$ ^) d" o5 `0 a/ L" A/ Z
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"; |5 a- j8 Y; j) V5 N9 z
stmt=conn.createstatement();( ^6 S m* ]$ p+ G$ ^
rs=stmt.executequery(sqlu);
! n: T% T/ j/ t& D* ^4 |%>% q( c, m. w+ t @; b! l
<script language='javascript'>8 `& J; Y- r. n3 V7 `2 i
arr = new array();# O% C; Z8 [6 ^% w
<% int temp=0;
0 m; |# B2 z( L% b) d- s( O) z: awhile(rs.next())
9 v. n. c4 q+ F* h, d( m& t/ |{6 d8 ]/ K6 @$ a4 l
%>
1 R0 m5 K+ t: warr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");' u+ Y) J$ ?9 S! A t
<%
$ h9 L/ T) \6 x6 x3 ^$ Itemp = temp + 1;% ], M; C [% o4 R2 C! `
}/ ?4 z, Q0 e2 @
%> A7 Z9 z( `! l% F; y9 Q9 D
temp=<%=temp%>;8 ]6 A4 M7 ?' C2 N& ^
function changelocation(id){
+ I0 u& D8 |% }- u) J9 y& Ydocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
8 F" Y% \& S4 F b1 _7 Mvar i = 0;
: G9 ^/ J' B, Pdocument.combo_box.city.options[0]=new option('-------','');
7 R& I+ R" S# `$ u J O- dfor(i=0;i<temp;i++){ / ^$ {% S' D; H# `+ z! W" x8 |
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
& A1 z! r; \% U! l: k$ W- A' Pdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); ; u) [1 \) A' B5 l3 q- e" z
} : {' f2 e' A; Z0 J9 Y
} ( L. }7 X. @. I7 f
}
, [+ x1 Z* i5 C2 S/ @% U% ~</script>
7 R K. g$ y. y6 N" ]" H* @! f2 @0 A ~; I
<form name="combo_box">
9 A1 N( N3 S d) I+ l<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">0 c& V6 e* N5 h) ~0 I1 W6 p: l2 J
<tr height="24">$ L6 X# m) p" Q6 |! |& {
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
' h# t/ _& e9 f5 Y% M( N$ B+ | <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
1 k' i1 g, l( E/ a4 v <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
* T+ q4 I5 c4 M# h <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>9 D$ V! K H4 e; w/ z/ R% f
</tr># D8 P, I2 L; T! a: `; g0 ]5 \ X
<tr> 9 ~) q0 ?/ l6 C8 o
<td>
: @3 J3 r1 _. u5 a& s <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">7 R4 h$ `6 I% l, G
<option value="0">请选择部门 ---></option>; C9 y" a5 I; N( |' D5 m
<%. X J8 N7 n- |4 N
string sqld="select * from tdept";0 O9 a: `7 r' M0 d4 E) D1 E7 U6 Y
stmt=conn.createstatement();+ V& C4 s& d, B
rs=stmt.executequery(sqld);
. d4 ^8 o; _2 i3 Lwhile(rs.next()): a* R' e, w, [2 v' @& @
{
; c z' ~5 R( C- _" j( _3 y. x%>& j2 ?) ]; Q& o1 q. b k
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>* e# F& ?( W2 b2 i
<%& i4 X% }* `/ T0 g+ q1 e: w/ T
}3 h* c( x1 i" f7 Y
%>
1 D' i6 j- x) l </select>, |4 { L4 h- ~7 c( J* Z8 L
</td>% ^3 H& W$ w4 P) D0 b% S
<td>
: M, r" v& m9 `( _' N5 S: X v: W <select multiple id=city style="width:150;height:200" class="bgc">+ O6 N) E' O/ x
</select>
& A; q( T. m. S Z4 \: h" R</td>
3 Z/ Y' R3 y" q6 K- X% ^7 {( } <td nowrap align="center" class="bgc">- H' `& j! y, \
<input type="button" value="<<" class="buttons">3 _- j- a6 @% c! c
<input type="button" value=">>" class="buttons">
, n6 }; R" u( }+ v</td>. ]4 h$ N- z! w
<td>! S+ U7 l" n) t
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">7 t) h, g9 @% B' h3 `/ K
</select>3 L# v2 j8 E q$ Z8 q/ u
</td>' B( _. g6 M7 m/ e: C1 {& z; l5 ?
</tr>* ]- X! \+ g# _# l, Z( p
<tr class="bgc"> ) Z. y. }$ ?/ G) _' }, z* O
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
" [0 A9 l6 e Q; d8 p8 a2 ^5 M/ T </tr>6 k/ c9 M; |# ^3 d
</table>
+ y, g3 n- Q$ b</form>
& O6 g( x- q$ @0 e<script language="javascript">
+ s2 `* m0 f, t% b( O' M: B//人名移动
2 s6 D7 G1 G% q# {2 L3 M8 Z- T' S( z: I0 tfunction move(fbox, tbox) {
6 ]# t" `- m4 |" }/ }) kvar arrfbox = new array();
{) Q: G' X2 I; s# Uvar arrtbox = new array();
8 L9 m1 R( ~+ m" O$ L( P4 C" Lvar arrlookup = new array();8 W0 p G# x% V- P
var i;
7 N0 Q5 C! T4 j {+ Yfor (i = 0; i < tbox.options.length; i++) {
: ]. P) N1 N; ?- Q& a. G! S6 Rarrlookup[tbox.options.text] = tbox.options.value;
- P; E' }$ a$ e- Z0 |8 Marrtbox = tbox.options.text; m/ v7 Y3 ]. G
}9 e% I( R& Z) y0 t: \
var flength = 0;; ?% t1 I# P* T# `/ V9 h& E, L, O/ Q
var tlength = arrtbox.length;! H$ ]( a: c1 B8 B( w
for(i = 0; i < fbox.options.length; i++) {7 X! v* e) |- E
arrlookup[fbox.options.text] = fbox.options.value;
) Z7 G+ b6 f q. F$ O) ]7 zif (fbox.options.selected && fbox.options.value != "") {
( ~; @; N; f5 K warrtbox[tlength] = fbox.options.text;+ G/ U4 Q5 X) A- Y3 j) g1 n
tlength++;
/ _0 j/ C* f( a& E! W}7 h [& r$ ~& o( c3 A
else {) e9 f6 l* q* i7 o( g% T! V/ [
arrfbox[flength] = fbox.options.text;- P s3 m# `, Q7 a0 X
flength++;
# J) b" z3 V" Y# a }: ?( Z* B2 f, W/ V
}
% v3 C/ Q3 r8 @3 f+ t7 c5 Farrfbox.sort();" q# K1 c0 K' B9 I2 J& u: w
arrtbox.sort();/ T1 O# I% p0 O. _+ [; P
8 f4 V5 Y; Q8 [" T- Y
fbox.length = 0;
2 Y4 }* Z, g# D% a) Htbox.length = 0;
2 ~% F$ g9 r2 E+ R/ U* C1 Evar c;- r- S- T w* R) Z$ k
for(c = 0; c < arrfbox.length; c++) {
8 t _$ l. d) m2 M7 P' z4 rvar no = new option();8 ?/ D w$ w, g3 L0 m" C
no.value = arrlookup[arrfbox[c]];
0 S+ x V. b i) t; W# Yno.text = arrfbox[c];
$ d( J& t4 ?) L8 j+ k7 r3 y) x6 Hfbox[c] = no;
* W2 b* U: L2 ^/ H}
+ R6 B$ t. _# T9 W/ lfor(c = 0; c < arrtbox.length; c++) {1 _1 W/ @* A# z, A& N, x
var no = new option();
' V) M6 X; W4 e/ |; B& vno.value = arrlookup[arrtbox[c]];
2 s2 p" Q( G1 B1 L0 ino.text = arrtbox[c];
- g0 G( K) a, I: i7 }tbox[c] = no;
: n' e; ]0 Y. W8 h }* U% y$ i8 F- a2 ^; o' h
}' R& ^$ J# d% q2 P1 T- {
</script>; k, C& o5 u8 D. N
</body>! y: Z, i, R! c* B9 b8 V$ L
|
|