  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14171
- 金币
- 2376
- 威望
- 1647
- 贡献
- 1324
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"+ m! i% e O0 Q- \5 F* g" b
c pageencoding="gb2312"9 z% _# G2 m0 D+ _& ?
%>0 o' S# T: d" J2 @. D! ~
<style>
- o3 U& i& e. a.f9{ font-size:9pt; }7 O/ e& `1 z/ u
.bgc{ background-color:#aecaf9; color: #0033ff }
0 I# d8 U4 n! z0 s; B.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
0 O+ x* X; \1 t border-bottom: solid 1px #4e7dc1;8 V6 _! f/ h8 c8 S [3 r
border-left: solid 1px #aecaf9;
" i* O% ^$ |& z9 [: w) s6 r X border-right: solid 1px #5679bd;% M( H1 ?2 L! N, b8 L9 }$ I4 Y
padding:1px;
+ d0 x8 q5 S' O margin:0px;}
8 L/ q& H7 ~/ G( I, l</style># o) o( C3 c( Z* j
<script language="javascript">. Q0 Z. Y, }: P5 m; `+ P
<!--7 i+ D& }6 e6 @( w
function rv(), |+ q7 I) G, B! Z
{, V& g; g9 A: K( j
var val="";" M) W8 ]( j* L3 w( H* f) d
for(i=0;i<combo_box.list2.length;i++){6 ^$ l7 D. z3 [$ x" T4 S$ P& g3 S
val+=","+combo_box.list2.value;. j$ I% R5 @$ V8 E& N
}1 n+ Q7 N3 N* `) u) o
if(val.charat(0)==","){
! }+ w9 Y! r7 t# s l val=val.substr(1,val.length);
; p. M; n+ O$ \- R& {/ X }
# y1 K9 `9 b) q; V opener.form1.frecname.value=val;
, N) y- E2 s1 |5 |+ ? self.close();8 x: q! I4 l2 g" x8 r3 _. |- x
}3 [9 S& w- r: Z
//-->
! ~' q. E7 k* k% b3 z. x9 M9 w4 q</script>
8 q4 t, m" I A. p# ^7 D<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">7 D8 C0 n$ c1 S' b6 T
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />4 @8 ^ X7 R3 ?$ M) c8 |! G( O& J
<%
5 e0 y7 l7 C0 T" m* c( q cdatasource ds=new cdatasource(); //数据联结bean实例
) e1 Z2 f, X2 o* i java.sql.connection conn=ds.getconnection();4 q# |' P8 ~9 n$ ~5 I
java.sql.statement stmt=null;3 _. ~" ] t1 v2 y( Z! O& L
java.sql.resultset rs=null;/ ~. r" ?- C6 r: p6 o# ~
cdatacheck dc=new cdatacheck();
. {9 o' a* _4 `; V0 M% ~. x%>
1 g( s0 K, i/ o$ ~! D<%8 n5 p9 D4 k5 v& H2 n. ^% o
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";
! Z% r2 P$ c0 n' a" astmt=conn.createstatement();
$ Z' U$ b; ]& n+ X, F5 Grs=stmt.executequery(sqlu);
5 o- c. H$ `3 E6 c3 @7 |%>% q% _( R8 X8 V, k, \
<script language='javascript'>/ h0 N5 A" h! x- |
arr = new array();6 P5 J0 b2 s( s' N6 Y- f
<% int temp=0;
+ F8 ^7 s' ?: Q. x4 zwhile(rs.next())( f; t. U5 J( g- N+ Z
{
3 o5 A9 u$ m9 m5 Q% U& ~%>! p( A! E8 v% a- ?# e! x/ w5 Q
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
6 z7 m9 Q$ d# {* k( P L% V) }9 g) e# V<%
! `2 R+ R: e: ^, v( V ktemp = temp + 1;" a2 A. f* v% b( _
}
9 z" {) ]% L# I5 F6 ~7 k%>
5 `- k# [2 T& Y6 z' b# |" o# Ztemp=<%=temp%>;
% ?2 ]' W' q6 k# ifunction changelocation(id){ 8 w. O1 F2 l# w5 k8 ?
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
2 P4 Y0 Q# C0 A' X1 wvar i = 0;
* z3 m( `' q$ V3 B) F; m. Jdocument.combo_box.city.options[0]=new option('-------',''); ! J+ z1 I5 s3 [" I( T
for(i=0;i<temp;i++){ + @) T( B F; e
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] * a) w* E- y( i3 `5 r
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); / W6 ^+ i1 {6 H, \
}
1 x7 \# t9 L7 z9 v} - x( K4 r! A7 R/ {2 {
}
/ Z/ r/ W7 h6 l</script>' i9 i; l( q1 w1 Y( P7 E% E$ e
5 b* R0 P+ Y6 i o
<form name="combo_box">; p: t; A5 j$ t! y4 o
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">! {( Z. }9 O7 G
<tr height="24">5 g: ?/ i& F+ N- q$ `; L% V+ \
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>. g, O8 f1 d% w4 W: [! ~- c9 v
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td> K0 {8 o& X+ g5 R) B
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
5 a/ \" C, J$ i$ m <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
h6 i* `$ N2 u* y3 U </tr>8 C& s& J7 N! \; r/ s9 |8 @2 B
<tr>
0 x4 q% R" [2 {/ Y1 w2 F* D <td>
- S& a# K Q) M <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">; X4 q' y4 f$ f
<option value="0">请选择部门 ---></option>3 R G5 S3 @; R1 x/ Y3 P6 A
<%: i/ ?! h, |5 g q/ ]9 T
string sqld="select * from tdept";( ^# {8 t* C2 B4 r9 c
stmt=conn.createstatement();
% O" W, p& {8 F) u- Q( o- frs=stmt.executequery(sqld);( J! y& T7 [9 x3 z' |! W) E3 W
while(rs.next()). _. f- C# M4 K6 K: j
{5 \6 a3 n2 i/ E! o( O- `8 r) [
%>6 p$ U/ \, N" m! ?, H0 K0 [3 A" X
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
; F7 C& {9 A9 _+ C2 q<%& g: Y$ U# _0 e8 c
}+ k0 V8 P# G3 S9 e ?9 A, r; I
%> # u$ x! |' I, Z, I+ H( L5 d% E+ U
</select>( Z' a: _% M/ H0 h5 N/ `. \! [ } m* t
</td>3 F. A1 U- {8 g+ y. r3 i8 y
<td>4 R8 b$ [* m5 P- U
<select multiple id=city style="width:150;height:200" class="bgc">. D+ s) {2 B( D0 a. w
</select>
; a1 \0 L3 V) t9 s5 m</td>$ E1 \2 k- i% E7 y% |8 S2 D8 G! m
<td nowrap align="center" class="bgc">3 o- ]$ X4 C4 I3 m* S; W' D2 B5 }
<input type="button" value="<<" class="buttons">( G: R! i7 O" \4 m: D4 N6 h0 D, x2 Q
<input type="button" value=">>" class="buttons">6 ?# \/ C4 U3 w* |0 d" p N* U
</td>
4 Z' {( X7 q* Z& U, A <td>( Z2 M# r6 n/ ~2 U. X9 S
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">& W6 ^& G4 g! F7 y: A7 d
</select>
* j/ K5 w' N1 p2 w: o6 K</td>2 d1 z- b8 C6 l G# S$ @
</tr>
' b# N* \( s* w* Z) i <tr class="bgc">
8 x. w/ \! ]$ I5 m" h5 ?; }& i <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>: ]& k% c. g! i \0 [
</tr>
% m8 X+ O* ]8 u9 S# C</table>' \8 }( `" P, @- U8 A0 X- H
</form>
/ c5 i8 C- S2 R# I6 H q<script language="javascript">
, t, M+ O: w$ ~4 I/ A" ~//人名移动
" {* p% ^4 J9 o; z8 O0 {; Jfunction move(fbox, tbox) {
3 k# Z7 T! r8 C/ o2 F# Q/ v8 m3 Tvar arrfbox = new array();& d' F0 {! s3 e* g- B
var arrtbox = new array();
% P, P0 t) ]$ S* {: ^var arrlookup = new array();: F; p* M5 k9 A: I. }* ?& B6 o
var i;
9 R, @6 P( X7 @/ a+ F3 nfor (i = 0; i < tbox.options.length; i++) {' T+ H" h1 N: o1 C' }) f$ F
arrlookup[tbox.options.text] = tbox.options.value;
: l( Y; |; b# l' E; `; U3 Garrtbox = tbox.options.text;
1 W% z/ \; s; `4 W4 n}
! D3 T0 L/ c" x" N5 S' Kvar flength = 0;0 {0 H- J; N; M6 `5 r6 T. k
var tlength = arrtbox.length;
) O. \8 g7 k7 R- U7 Y/ O9 C7 nfor(i = 0; i < fbox.options.length; i++) {
, u0 f5 i3 V3 k" W' aarrlookup[fbox.options.text] = fbox.options.value;
* \& |' q& z7 l, V9 E* g% Kif (fbox.options.selected && fbox.options.value != "") {0 }, R2 q5 l' Z' ]
arrtbox[tlength] = fbox.options.text;3 h+ i, t) q: [. Z) x
tlength++;1 G3 X( V0 u9 X- r! i
}' |1 o1 B5 u4 R0 S: c2 S
else {5 R* J4 d% X' u9 x- J/ K
arrfbox[flength] = fbox.options.text;6 ^6 h! q4 [2 H9 ^) f1 e. f& S7 b* S
flength++;
' | n3 }3 }9 Y9 Q y5 ? } \) u3 B/ w& M. s
}0 \8 ^0 y/ `1 S2 f( G5 R& i0 @
arrfbox.sort();
1 @# s6 D$ ~/ R+ D( r, ]" q5 t% p) Rarrtbox.sort();
; G8 E! q% V* M1 H# z
2 k/ `, t" i- u# @) Sfbox.length = 0;; g. a. D/ a. G# P: U# j7 X6 Z
tbox.length = 0;+ n2 f; M2 ]" O$ i Z) |( U7 X& `
var c;
: B9 u# z4 j9 Ofor(c = 0; c < arrfbox.length; c++) {
I/ ^* \* \/ F. X/ Z/ \* i7 J: P' j+ gvar no = new option();
0 j3 E7 y' [4 X/ p. `! X" ?1 e6 \* {0 ano.value = arrlookup[arrfbox[c]];
8 |/ B; z" z$ L2 L$ L5 @: Dno.text = arrfbox[c];
4 Y$ {" h0 _5 o! Q, i7 ^+ `1 yfbox[c] = no;# K9 N- w& v: f$ r/ ^( s
}4 f+ B/ k7 J, i6 ?: @0 K
for(c = 0; c < arrtbox.length; c++) {
# G) h; e- D7 T. {var no = new option();% |+ t9 m& ?" V0 `! N
no.value = arrlookup[arrtbox[c]];
5 r; h, g' M2 J( k# wno.text = arrtbox[c];8 O3 K0 s$ G, O2 ?6 n( r- o
tbox[c] = no;
2 Y: }1 n4 {$ v) i' H" } v% f }3 n6 W, W* }! t, b, c6 e+ [
}
4 \4 A' I! n, l& f0 P5 S7 f</script>& x" \" w( G( i4 U/ s
</body>: q- g! X! P( K6 Z
|
|