  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14197
- 金币
- 2389
- 威望
- 1647
- 贡献
- 1337
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
/ f5 s. K8 K1 { c pageencoding="gb2312", V5 f; J+ t, R `
%> L E5 B# U ^* L
<style>& r O; o, j6 O$ [
.f9{ font-size:9pt; }
# W+ [& h8 u( H& x.bgc{ background-color:#aecaf9; color: #0033ff }
9 Y) F+ J. P, m6 K0 _6 V.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
9 Y1 r' W/ Y* M" o7 w0 |4 r! D border-bottom: solid 1px #4e7dc1;
& k' ~8 c& Q: I( [4 C border-left: solid 1px #aecaf9;& f0 U% P+ O7 `7 {
border-right: solid 1px #5679bd;' m; `. O3 g1 D- _8 e2 Y
padding:1px;; f2 K0 \/ m7 P7 ?
margin:0px;}
3 U6 B6 h5 n R</style>3 N0 q) S- q# m& T t2 B4 Q
<script language="javascript">
- L0 t" S/ t0 Y: d% `: x( A! X<!--
: w: y4 j6 w/ B- E! yfunction rv()) m5 n7 P& O* g) W$ g. N. k I. ?0 }
{ F2 @$ X ]( E: G( j
var val="";' l4 U2 r0 a0 g0 E* g7 u. }: m
for(i=0;i<combo_box.list2.length;i++){
. f4 j6 ~7 _8 r" k K9 X! ` val+=","+combo_box.list2.value;
6 K5 z" r2 |" \ }6 j+ O* m" C$ {7 x7 M$ S5 ?% M+ z
if(val.charat(0)==","){3 v! x: Q! l: S$ J7 Q9 ~2 s
val=val.substr(1,val.length);
* p6 b8 ]1 Y* W1 T% _6 Z K2 Y3 [ }
( ?( d( @. e5 u! ]5 K4 Z( C5 W opener.form1.frecname.value=val;3 [* c, ]( Q- B
self.close();
p' R+ T9 |4 ]& z}3 m9 B( {/ R [" ]9 {
//-->) ^2 T5 O8 i4 w! M, U! `
</script> z- V0 A! ?% v i0 c5 q- V
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
1 v6 p8 S# Y5 ]. i! T# m<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />5 @% y. b1 l3 g
<%0 n# A+ J: P9 U* p/ y @2 f2 h
cdatasource ds=new cdatasource(); //数据联结bean实例
: M3 P( r$ u/ s( M0 o) C5 `5 U java.sql.connection conn=ds.getconnection();, H6 t n% D2 c4 f0 S! d* R
java.sql.statement stmt=null;
7 ?7 |" q9 l9 W7 S. {3 C1 G java.sql.resultset rs=null;' F0 {# n; s5 T) }3 S$ U; E4 q$ }+ B
cdatacheck dc=new cdatacheck();
, H5 k- ?9 Y. E+ F' U# v1 _! }& t%>( x5 {7 b* b6 H+ U4 w5 r2 f
<%4 x# o2 \* N% U e+ _2 E
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";9 l$ i3 u5 m# ?
stmt=conn.createstatement();- \: T3 n" o2 m8 s
rs=stmt.executequery(sqlu); a W) T& p9 R. Q4 C3 x3 B
%>
) p2 I9 g1 a6 i0 b2 l<script language='javascript'>
" L# f# h( J' ~ d4 k3 {arr = new array();' v' T- F$ G) ^
<% int temp=0;
5 U4 U7 N/ m/ ~( M, G9 t! mwhile(rs.next())' i5 H; h0 b- q T+ r `9 }: @7 E
{$ P: L. D n9 h# g4 ^# \
%># x: D( b$ f! W' P
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
3 B6 Y) W# T; w* y. ~! `<%
/ x9 I1 ~; R+ {9 d( ~temp = temp + 1;0 p( N6 i1 U1 f8 o: b
}- o2 a9 B E' \
%>
0 ^, Z. N3 Z8 v; M' K$ c7 W0 Gtemp=<%=temp%>;
- L& J$ a1 u; y0 }$ rfunction changelocation(id){ ) O9 z# F7 N' X/ B' Q. {
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 & K, ?5 Y/ I& p! I9 t6 M% Z
var i = 0; ) G- ]& g; d$ `2 [4 a
document.combo_box.city.options[0]=new option('-------','');
1 u" }- |, ~4 t1 Tfor(i=0;i<temp;i++){ * }# \3 g* p1 c. `) W) c
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
% |& {: ^1 H) `* U0 s) w% Idocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
. @/ v6 p* B# O+ m/ K# ~8 _}
, }9 z/ V c: b7 [} # g8 o2 r# [7 W8 ]3 ?
} 8 h2 a5 c C0 q3 p
</script>6 _9 S' y+ }' [! m' O
~( C6 Q% ]" j( X
<form name="combo_box">$ k3 }4 U+ ^. V- Q
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59"># m& s, c5 Z; D) |7 p
<tr height="24">; J+ d5 Q5 U, D7 A6 m6 m
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td># [7 M% u' \0 f, y* i, U, B. ]
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>6 x7 l7 T9 C. @2 ]2 e
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
" _- m9 s8 A) _ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
; g6 M* B t% r: S) G. r' ?8 | </tr>, L( {; z4 i- {; b! l
<tr>
# N1 n3 J5 X4 x: M M <td>
" R& S! X5 u' H. ^2 }( D <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
/ S; J" M6 W7 q <option value="0">请选择部门 ---></option>2 s! a/ [+ w; K2 }5 {
<%
) ?" B B0 M* S! | string sqld="select * from tdept";
/ {1 z* y: h3 q9 Ostmt=conn.createstatement();& T* ^6 c0 e7 k. d
rs=stmt.executequery(sqld);
. @( _9 Z$ B* z5 Kwhile(rs.next())
/ D& y( c/ y9 b! D0 y8 _. j{
! n, E7 _" X2 Y2 Z0 U%>' E* r# [2 P( x- X9 v, C
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>3 r& S. n# p4 N. H* h' T2 K
<%
* c! c6 G3 G$ S# n/ T w}+ {$ V. t0 U& x" ~" V. k; P
%> Y B# c) f, F1 B9 m/ s
</select>/ c& G' W( j6 _) N$ B$ k: i2 i
</td>1 f" D% m( ], x1 L' t. N9 Q
<td>
6 g4 c" Q% p* F1 d$ l <select multiple id=city style="width:150;height:200" class="bgc">2 y$ o* T( ]3 x1 f
</select>
7 m8 b# T. ^. e1 c/ l</td>, L# j @9 s# d! P0 \+ \) K+ b9 m
<td nowrap align="center" class="bgc">
* I8 b( O/ K, P* v5 w <input type="button" value="<<" class="buttons">. d6 _; |# b; c8 u( [. e
<input type="button" value=">>" class="buttons">- i5 k) ]+ L0 v5 A2 l7 A( Q4 w
</td>1 A& h: t- q0 m+ w; W ]+ r) o
<td>
' K( T6 m# E5 f! I; p) H% T <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
5 f6 Q- K: F3 f </select>+ L6 }* |! w: x8 N X! z- C9 F; M
</td>
& k2 T7 K; t2 ?- m! X, T </tr>2 |( ]1 t0 M, r% `4 o
<tr class="bgc"> ! {, Q5 H5 X& h: G4 o- U! ?
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>5 t; ~/ U1 h2 g7 |0 d5 Z
</tr>
" s, g" m. N4 Q6 w. Z</table>) l# v9 B$ f$ e" s7 z9 k+ H/ f
</form>2 |. ^/ D0 X# }2 p' t
<script language="javascript">1 j5 s6 w' b9 j' L8 [: Z
//人名移动
4 n) I" v6 T% Q9 b8 v" f: p6 D4 Cfunction move(fbox, tbox) {) I8 g. L( a, K/ R+ a( O, r' w7 w, P
var arrfbox = new array();2 I$ q5 W: L& j! Q0 Z
var arrtbox = new array();$ [$ J# H2 z f
var arrlookup = new array();
# P2 Y# v; N. C- J- ~: dvar i;
+ P$ w4 H0 k0 x7 d( Dfor (i = 0; i < tbox.options.length; i++) {
3 }+ ?. s, s# p; g" Jarrlookup[tbox.options.text] = tbox.options.value;
* p1 ^; ]) p' S' d+ g3 }2 zarrtbox = tbox.options.text;
; ~1 K4 l! a/ b9 c7 v- c7 v# B}3 ]; H5 k8 T; v
var flength = 0;$ \/ Q1 @: o' v* [; \! D7 F
var tlength = arrtbox.length;5 h9 U _ d. g, d& P: ~, g& b
for(i = 0; i < fbox.options.length; i++) {5 `2 I; N# r/ i% C* j
arrlookup[fbox.options.text] = fbox.options.value;
* k h7 ?; T+ k; Q, e- a% Sif (fbox.options.selected && fbox.options.value != "") {5 ]* j! I2 [/ H4 y
arrtbox[tlength] = fbox.options.text;
. ]% }1 q+ C/ ]' Ptlength++;1 i: A( |' V4 Q' a2 q& i& b+ J* S
}9 g8 n, s f& ^: A7 Y, Z( c
else {
. ~# ^0 P- [% A& t8 ]arrfbox[flength] = fbox.options.text;
0 ^/ w6 ^2 i0 y- Kflength++;
6 L* h% g" u$ o0 Y1 ]3 @1 S+ ~ }
$ d0 f9 Z Y0 }}
# n) I ?9 n8 r2 B& W, narrfbox.sort();
+ X1 Y, d e4 y2 Y, harrtbox.sort();! c. P8 Y) Y* Q; R: m
! l5 `0 R/ M; ^& x4 h
fbox.length = 0;9 R2 O+ K" o- [. w* s
tbox.length = 0;
$ S9 [5 u4 Z" g" P& Q) ]var c;5 k& s z+ W/ l# h: G2 a
for(c = 0; c < arrfbox.length; c++) {
6 W# j8 E0 z# O3 {5 Q, Evar no = new option();( k9 h3 j# P; `: A8 a: O, d# M& }
no.value = arrlookup[arrfbox[c]];8 \# R, j" H- X# Y; P2 S
no.text = arrfbox[c];
; O5 z+ j L# ^+ v/ Pfbox[c] = no;
8 G3 W8 Z1 }! v4 H- R}
6 T0 v4 t( N9 [2 D6 J' T2 efor(c = 0; c < arrtbox.length; c++) {9 X9 I) _. q3 a9 u5 g/ S1 i$ h- S
var no = new option();
- E5 @0 Z1 M. e ]3 Yno.value = arrlookup[arrtbox[c]];
. w9 l- H' e4 a. W3 Eno.text = arrtbox[c];
% A! ~# S' ]9 e4 ?3 `tbox[c] = no;
% S# J3 S0 t# C }/ E' {- Y F% _
}5 K1 K" ~) {( f p# x
</script>( S; X, {# `* s2 n& M' }3 c, D
</body>1 O5 }9 ]6 j7 C; |% D3 W9 O
|
|