|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14433
- 金币
- 2502
- 威望
- 1647
- 贡献
- 1450
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
2 y6 ^4 o; g/ R c pageencoding="gb2312"
. }1 j& P; w! H%>+ g3 j6 G' o8 U3 O" @5 q& O
<style>
$ e2 {* H# x' F4 B.f9{ font-size:9pt; }9 Y5 k' K% M9 G. ^' k. t- o
.bgc{ background-color:#aecaf9; color: #0033ff }: d9 ?" P9 C% w( S6 S
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
& ], `) C/ g W* ~: ]: Y border-bottom: solid 1px #4e7dc1;
( s' `- y. s7 i8 p border-left: solid 1px #aecaf9;# K9 v v+ Z8 T' N" x2 r
border-right: solid 1px #5679bd;
2 B2 J% H8 a% _7 m8 o* W padding:1px;
, W( D6 ~+ P. e" C/ ?: I margin:0px;}0 g/ F2 a9 y0 y$ X! b9 J- q1 R
</style>
$ P3 I+ e% D) M: V- |<script language="javascript">1 {7 i" H X9 D6 _6 ~7 q2 p+ p/ ^
<!--
! r0 l- k) d1 Afunction rv()
1 h4 m( c5 X+ y' J# b{& {- h+ W( l1 X
var val="";) K2 B8 v, Z/ h
for(i=0;i<combo_box.list2.length;i++){
" ]& S. k( ^" _4 I6 k5 _% ^ val+=","+combo_box.list2.value;
7 L6 z- d& o9 B1 A6 }( h }( a; {6 \- v* z% W0 G
if(val.charat(0)==","){1 b8 |, E( p. T
val=val.substr(1,val.length);
8 [2 u" g3 Y$ }) A( V6 d; E }, v2 L& o5 G3 k2 I* I1 v
opener.form1.frecname.value=val;
4 b' O: ~' C- w* T0 O self.close();
, e& L# w1 f; r- P9 @9 N}+ w s, R, [$ m# B, N& L; ?
//-->: i. Q3 i# ~% H1 G6 O! l }* J) M
</script>
9 j- Y; j4 K5 f( ]<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> K3 f7 A. {* {3 _1 n2 e2 Q
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
7 X3 C# b [, V- r: L- x: B<%
( d, v2 i4 `! Z5 y' c* B* ] ]4 I$ Z cdatasource ds=new cdatasource(); //数据联结bean实例
4 @1 m7 r0 S' W% p6 w java.sql.connection conn=ds.getconnection();# u0 W) N `, p ^/ U
java.sql.statement stmt=null;7 k+ ~0 M3 N. a- X4 P- d$ P* [
java.sql.resultset rs=null;7 m4 v$ ?" ` v. V. h: K- L
cdatacheck dc=new cdatacheck();$ x0 @$ c6 g' B& c5 U$ c L
%>4 T: S9 _# D/ p
<%
* e! U' z1 [8 X9 r: ustring 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";# R. G$ q8 Y$ q9 p
stmt=conn.createstatement();
! F3 y2 ?0 T/ ~4 crs=stmt.executequery(sqlu);1 Q# r: i+ |, p" J& g- H! B
%>
/ B Z5 u* j! Z$ W# m2 g<script language='javascript'>
; I! `* d t2 { z" ^3 narr = new array();
. }- B& b) Y6 s k1 q<% int temp=0;
: P1 s2 H0 b6 \/ B. O0 N3 Pwhile(rs.next())" N6 D4 W% \5 S1 M, ]9 X
{4 @* c" o) b/ A8 r5 b
%>. j1 z3 H5 ]6 ~2 R& O
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
% l3 `% O6 R1 q) `1 v6 Q+ v% s<%
+ j t% G5 s# c6 k; Utemp = temp + 1;
0 i9 @* U1 D- ]- o}& E( V& n4 I9 s9 k% e8 b+ h
%>
" d* r3 Q e2 t$ O' G0 {6 c! Etemp=<%=temp%>;1 B* W4 l& g4 M8 }
function changelocation(id){ ; g/ u v" p$ O9 K; O" M
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
. O2 v, r: Y& u) w8 ^& H% bvar i = 0; % ^: X- j! _! H& |
document.combo_box.city.options[0]=new option('-------',''); 4 I ?8 O# _1 c* ?9 |3 p; ]/ `
for(i=0;i<temp;i++){ ; ~' [' w9 Q3 s! q6 T ?
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
1 ?/ K* }4 g/ L5 l" wdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
/ u9 Z- t. ~& q1 ]3 U8 N; E% `: C} ' p5 A8 |9 h0 k% S
} / b/ G" ?0 q- z
}
( }! B; i8 R; Z$ z# p</script>/ _6 J6 X% h) l. J) r8 ?
2 d7 u, l5 {: G
<form name="combo_box">
2 A/ u, v6 U- e! H" H1 D<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">4 P0 w: B- r6 k% e
<tr height="24">7 ~7 H( z# q) T& G/ V9 O ?( I4 z/ [
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td> ~& z, y- `$ h/ Y! i; S
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
# V8 ? P; e8 P& r <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
1 s- @. l8 p% X$ M/ s' z6 Z: O <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>, E k0 {, B# n1 g, z" K( L
</tr>; J7 r; |# G- T! D
<tr>
. J2 N( n K: ^ s% Q J8 R <td>6 f4 N9 X9 B; ^. L! U' f
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">+ ~) e, a! z: ` W$ D0 d' V) W; \
<option value="0">请选择部门 ---></option>
! B. X* b* L7 m2 n9 K# t( T8 P<% l8 y6 E6 M8 Y( ]* [
string sqld="select * from tdept";. C9 g5 c3 [% M- z/ F. \; `" l2 B
stmt=conn.createstatement();
' D' [, W* S; _& P1 m; a" ^rs=stmt.executequery(sqld);
" o [! }/ B& v/ awhile(rs.next())
' i6 C5 t$ s: e{; j2 ~) B* y( B% h* q! p* s4 I
%> d' o) R Z9 g7 s8 f
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
# L7 P6 v6 Q% T, k: g<%
- \ v- [7 b; V6 P7 B}
* j) Q# u0 h T1 \: ^ \%> & O0 [; h- I% [
</select>) c) I* _ E, b
</td>3 @7 I( b3 S1 H. H& t
<td>
0 n5 N& T& l& `: i <select multiple id=city style="width:150;height:200" class="bgc">2 n1 m$ j0 j- S# K) Z# m* Z! R
</select>
! k9 _* T6 m. l. {. X$ y</td>
+ i4 f$ i+ [' h7 J' e; [ <td nowrap align="center" class="bgc">
3 r! r, q& l# |. z; X6 f <input type="button" value="<<" class="buttons">! i3 A6 p3 E% D5 C6 F7 w4 W
<input type="button" value=">>" class="buttons">* O7 U# P- A5 C
</td> D6 N7 N y( k7 s$ R, l3 A1 V' {
<td> M: z/ w. V+ o, l/ b3 Z
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
' _& x, F* c( {2 z6 ?$ q </select>6 j* j8 @2 } c# P, O1 c
</td>& l/ Z1 u# p# \7 a9 g
</tr>
8 R, o* U9 m5 g+ Q* r <tr class="bgc">
/ `7 A# W. ]6 V, r0 q3 h. ]5 H <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
' v2 E5 g% U( W& E" P </tr>: t0 |: Q8 a) t- v3 l: a% w1 ]
</table>
+ A& N y9 E4 u' P- W3 V</form>
( X# h/ o* i$ ~<script language="javascript">
( V! a i' @9 F//人名移动" m( ` r8 W I
function move(fbox, tbox) {/ r; | T/ e$ a% ? z( x
var arrfbox = new array();( Q( g6 k# ]1 N. M5 z8 i. i
var arrtbox = new array();" J- l) y6 R# w! x1 t$ S2 m
var arrlookup = new array();
; M q! q9 A# N x, xvar i;
/ h5 k) W2 R, n+ sfor (i = 0; i < tbox.options.length; i++) {( x/ h ~# R* X4 J' D
arrlookup[tbox.options.text] = tbox.options.value;, E: s- ]# ?% M5 U: ^0 I3 ^
arrtbox = tbox.options.text;
6 E; F; i! w* p! ?, S: \4 o p4 {}0 p9 g4 d" B+ W, e8 I/ u
var flength = 0;9 _ k+ `2 A: n- i
var tlength = arrtbox.length;2 o; M. Y: J/ b
for(i = 0; i < fbox.options.length; i++) {% }/ R1 @% n, ]& y; L) Z) l
arrlookup[fbox.options.text] = fbox.options.value;
& U! z7 G" |4 V8 r, F# C/ J, K( Zif (fbox.options.selected && fbox.options.value != "") {4 ]. f# P$ {4 a! a" g) s
arrtbox[tlength] = fbox.options.text;
7 C2 Q7 j- ?, n6 P: ttlength++;
( v, q; S; V0 R" p}9 t- U# Y5 A$ \/ q# M7 ]( U+ [& w
else {
$ q& Y$ o m5 I& j+ x4 aarrfbox[flength] = fbox.options.text;
, M) T/ q2 ~3 |% uflength++;! _9 E/ L; @7 m( w0 o
}7 B; l' l, s7 h4 y3 k0 B
}# ?: l7 f: q _% l, s- V2 v
arrfbox.sort();
/ Q- ?% @: [) Carrtbox.sort();
( K n; c, J$ i' Q; I$ d; N
$ E) O/ _) O4 z3 F F3 v) Qfbox.length = 0;3 h) C0 _+ K) S t. S* R
tbox.length = 0;
$ Q$ T% R3 K. ]: uvar c;
! y; _4 v* S3 X9 ^4 j" afor(c = 0; c < arrfbox.length; c++) {
( f v+ y6 W2 ^# F# h% ?var no = new option();
8 o6 Z, u- x, C6 }- C; T! sno.value = arrlookup[arrfbox[c]];1 M: d$ B( y8 |+ X! p3 D6 }
no.text = arrfbox[c];- s) m1 R2 h( T" Y8 X8 O" ^
fbox[c] = no;
k, m# ^) B9 }' h# Z( e" j3 h2 |}( K Q+ ?% D2 ^+ e7 \& h
for(c = 0; c < arrtbox.length; c++) {- [4 p) s0 `% l8 a x5 H
var no = new option();. x2 t3 B0 a6 b. i
no.value = arrlookup[arrtbox[c]];. S; x6 S, @+ Q) L2 `7 L7 e
no.text = arrtbox[c];0 e8 k) n' R- S3 k: q
tbox[c] = no;
4 y1 j3 L* q" O$ { }1 C/ ~! k& l, P. d. F- F# z
}
$ \- D, `3 w$ d</script>
1 B9 h, L0 O% Q* F1 |</body>
" u9 e* D) h% |0 Y. ~ |
|