  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14159
- 金币
- 2370
- 威望
- 1647
- 贡献
- 1318
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;", g/ p! P' B; m( Y
c pageencoding="gb2312"9 [. @& w5 h0 H, F
%>
* O N3 @+ R- w8 k! g<style>
/ } d; X& ^ X% P8 n, |.f9{ font-size:9pt; }
1 a+ n. S0 G$ J5 k8 A.bgc{ background-color:#aecaf9; color: #0033ff }9 t- m n9 S& `- l; _! ~+ z
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
& s3 N) X/ X r border-bottom: solid 1px #4e7dc1;" C9 y i* Y5 A3 Z) f8 @, O/ z
border-left: solid 1px #aecaf9;) D6 v% `5 s/ H( O% U
border-right: solid 1px #5679bd;
- ~+ B# f! ?5 D3 ]* J6 h padding:1px;
. h. E" o, w4 E; \3 A margin:0px;}
+ Z; F1 e& f3 [* D</style>
# L9 q/ g6 f) p0 y; ~" C<script language="javascript">
$ f& _7 [- e( ]9 J<!--% s8 Y. }1 u$ z; x- v# o
function rv()
0 x/ v" X4 K, V{
; O7 v8 ^. b# C/ W var val="";
# f0 x! m7 n& d for(i=0;i<combo_box.list2.length;i++){( q+ Y) c K. H+ g+ _1 T$ E: Z# _
val+=","+combo_box.list2.value;+ l% F% g+ ]& B1 d: i) \
}
' n+ h i% }: x, k) @ if(val.charat(0)==","){7 ?/ r3 |3 Q9 e& @- W
val=val.substr(1,val.length);
0 c0 n$ S3 y5 E( T; k1 ^" a) O5 d }1 B: M" G9 I7 u0 w
opener.form1.frecname.value=val;7 o$ d) a" b8 D0 b8 o8 J7 N$ {
self.close();7 }- L$ ^8 T4 j" V) r$ W( |7 B
}# ~. m8 Q! O' ]% G5 a4 E9 y
//-->( Q0 n u1 v) }5 {7 Y6 G& C0 I) L
</script>
7 m- ]6 _( h; m" P2 E3 j2 W2 S<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
2 K+ U( \! G ?9 x8 Q<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />; ?% F4 Y2 @3 y: [+ {
<%
& l2 S8 h3 o Y- H cdatasource ds=new cdatasource(); //数据联结bean实例
T5 X: k6 T: v$ e+ P+ f( L java.sql.connection conn=ds.getconnection();
: d' z% u' @/ A+ P1 ^ java.sql.statement stmt=null; Q' r7 a$ A; i3 D- b) J1 C3 T
java.sql.resultset rs=null;. Q# m* E; L& J* I; `( q0 j8 I
cdatacheck dc=new cdatacheck();
6 v" X. H" _) l# y$ n n%>7 S! X; T! f* |( e ~2 l1 I5 z
<%
7 o2 R( K; W; T1 ]7 W/ fstring 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";, j" ]1 X: m9 C3 @7 B' f$ [
stmt=conn.createstatement();+ K4 J' H! b# K5 ]) U0 K9 U
rs=stmt.executequery(sqlu);. I. @* F- ]4 f, A* w! T6 f
%>
7 F, m* ~$ ^0 \+ [/ T<script language='javascript'>
3 W/ f% W4 d d D. Q. c' narr = new array();! W* @2 k: V7 Z5 a3 r# f, q
<% int temp=0;; y% I9 N# N. L; H. h7 N
while(rs.next())* [8 E8 V$ r' n9 r! A" |
{" K z: j% u& B3 ^0 l/ x/ G
%>5 H/ a$ n' _7 y5 l0 d
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
0 e; z# T r [7 j8 Z( r<%
2 f S' w" s' P; W S6 r5 n! X5 i2 ]& `temp = temp + 1;, ?+ J9 U- O7 X. x% ~
}
$ E2 u' V' c% |9 R& R; v. k; L%>
/ U: V1 _& h1 F6 T/ m! P/ k) [0 ]" qtemp=<%=temp%>;
3 ] { o1 Q, Q' y# z* G. t! Pfunction changelocation(id){
7 I$ F& E% P# t0 Mdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 1 _8 H8 k2 J$ U
var i = 0; * `8 B8 F6 U; S& b' d
document.combo_box.city.options[0]=new option('-------','');
# p4 Y. J& f2 W( Mfor(i=0;i<temp;i++){
4 {0 S- D% S! H2 Y8 _5 \8 Fif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
" b9 R/ b. T2 e, ]% ^0 j! Z% Cdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); * S& R, Z5 k- Q. p# m- o) b
} 5 I1 I" a- \8 T/ F6 n n
}
+ |: f* @9 Q% y}
" [, @+ M' n6 h! `7 a</script>0 s1 s' f/ e/ ^) P) o( H5 @1 L
3 T& e3 Q6 `. ~! K5 R$ ?: H% b<form name="combo_box">
/ D7 u! G3 g6 a- l) e3 v<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
. l( P) Y" G9 B( R9 g U- n4 K9 s <tr height="24">
+ C; E+ m: \9 T0 W; o/ B7 V <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
, E8 `8 C) ~5 B' [ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
* J8 R) h9 ^& S8 t <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
% j$ Z7 {5 q8 c& s$ v4 W. Y <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
$ n9 z" [5 E$ ^2 g+ }+ E </tr>0 D. z) K3 T* c% P7 I
<tr> 8 N4 [( T |+ r+ u0 s# }# ]- G9 X1 H
<td>
# A' H" |4 S# d( b+ C& H <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">( k- Q% s# y3 I9 v$ a7 X! Y, Q, [
<option value="0">请选择部门 ---></option>
# X1 }: [; K) E6 z<%
6 h" y) h% ~) u4 @, t% Z2 { string sqld="select * from tdept";
3 _( S& A9 G5 \4 _stmt=conn.createstatement();6 w! i% ~! A& T+ H7 r3 l7 O9 X+ u
rs=stmt.executequery(sqld);$ n' |; n/ h8 n" i$ j4 R7 V
while(rs.next())- R; j: P' @! f+ h& }0 |% F
{/ K; n1 }+ m7 w/ k) T5 e* u
%>$ b& E; z6 {/ A) @8 \+ o
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
% a. B- Y4 G5 l( |$ K5 `4 x6 x<%
# `" v1 o: m/ E- G3 Y}4 d; \0 `' j0 E8 X, y# a9 P
%>
9 ~ D. ~2 j$ r x( ] </select>
! X7 L1 G9 e: l0 X/ @</td>& C/ f. C4 W: w7 p- s& b
<td>
, ~3 k# g5 _( V5 Y4 q# G <select multiple id=city style="width:150;height:200" class="bgc">
, @, q+ R3 w1 z% z% J. n: g* j </select>) u- q0 j: g# [7 }" i
</td>
1 y# b0 w% X, m3 P <td nowrap align="center" class="bgc">3 D' M. ?+ [- R# c% I
<input type="button" value="<<" class="buttons">( f0 o8 J' n8 u e4 n4 X5 M- q+ [% H
<input type="button" value=">>" class="buttons">
$ T4 y1 ]& A8 m: `</td>
0 a# g g3 I4 @: n1 `- \# g& ` <td>
% q7 ?4 ^ P! c% O5 t <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">) C7 C. q- `1 Z1 [1 a
</select>! L/ ?( ^. K) |" D# x
</td>; s9 K! ^% F! [, ]
</tr>
% U% b" G S0 v <tr class="bgc">
/ p2 Y [5 b& a9 B, l" [: W <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
- ^4 n) d- A V' h: s$ w </tr>4 n5 ]1 w6 I1 O, @. D
</table>
. O U+ C& _$ W& w( n; {</form>
3 e; v; A& m. |( \% N/ M1 O( M<script language="javascript">6 U7 N; o. z; w9 Z3 D+ F+ W
//人名移动6 `9 E- ]9 ^& R( H: s! o2 _
function move(fbox, tbox) {
0 ?% Z& }& ?4 c, p$ nvar arrfbox = new array();
; Y% S: m( N+ o- i, ?8 Yvar arrtbox = new array();2 }* y% S& J" U1 ?/ p3 g
var arrlookup = new array();
0 j3 d) Z: x. K& `" x) \4 Tvar i;
0 _) u) ?3 c9 A2 kfor (i = 0; i < tbox.options.length; i++) {
2 O+ C+ \5 D7 E0 S' _9 Jarrlookup[tbox.options.text] = tbox.options.value;0 Y4 E5 J2 E% D) K. Y
arrtbox = tbox.options.text;3 Q3 c, b! P3 G( f7 N
}! E: Y6 P; Z. J0 A/ R. T* H
var flength = 0;# T3 d1 L( Q4 X& S j
var tlength = arrtbox.length;( r! O4 b5 U' g1 o
for(i = 0; i < fbox.options.length; i++) {3 a5 Q& p4 J& v! @# B
arrlookup[fbox.options.text] = fbox.options.value;* D2 Y4 q+ x# S1 S$ T+ q
if (fbox.options.selected && fbox.options.value != "") {* a9 C7 P, `' \
arrtbox[tlength] = fbox.options.text;) |6 y9 J5 O8 C' Z
tlength++;: h, g' f9 t3 o$ x! V4 B! R7 q
}
1 k. T3 v' ~2 F3 W% Telse {
2 F0 o9 Z9 M0 ?+ o1 zarrfbox[flength] = fbox.options.text;
9 N% s0 n2 h- G! K9 Kflength++;
$ C7 u. e# \3 x; {' A5 c$ V$ X }
0 @1 |! N3 c7 V* }; _- g" |}
" g8 h: V+ d( g* ^arrfbox.sort();( k, V/ W h1 I# ~8 | b
arrtbox.sort();; O) P' k9 Q- t+ ]8 E- O4 j
. a' b/ d5 S( x+ t
fbox.length = 0;
% J" Q8 S: d7 N/ S% L& htbox.length = 0;
) [5 g% c' Z' m; ^! q/ F# Fvar c;
- R1 M% K3 k- G |& j ffor(c = 0; c < arrfbox.length; c++) {
' }- `% G; k- Yvar no = new option();8 t3 E# a7 @3 Z: ~0 I+ p
no.value = arrlookup[arrfbox[c]];
6 y: @. @. s+ P3 y2 @" ^; [no.text = arrfbox[c];* r9 |7 a Q5 W5 e3 R9 {
fbox[c] = no;
7 K4 ]# c; q6 h2 |! D' G}
/ n1 h4 I7 `" Efor(c = 0; c < arrtbox.length; c++) {
; J( Z* y# m( |% T, x6 F( Ivar no = new option();2 e& c! U- K7 n& Q( Y" f; n9 I+ ^
no.value = arrlookup[arrtbox[c]];" O" q5 S- Y& j. G: i1 c
no.text = arrtbox[c];
! E$ d8 Q' J* etbox[c] = no;
% N+ Z+ h4 y/ p% ^/ t' A, g- J8 s }
# Q0 h' z" a* a; t3 a+ [1 q}* _9 h; F o* ~3 Q# A
</script>
# e2 x* u( p8 Z</body>
2 @ M8 q8 T1 q+ |* F5 j |
|