|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14395
- 金币
- 2483
- 威望
- 1647
- 贡献
- 1431
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
9 z. e! x' Q! l2 W6 {- I c pageencoding="gb2312"
& r2 i2 P$ l' L: _: c& }3 B4 p* H%>
9 A$ n t2 h# B) }+ {<style>
8 d; E/ c4 |) j, v6 y Q.f9{ font-size:9pt; }
$ y3 P8 c* _& A: ~0 r# r.bgc{ background-color:#aecaf9; color: #0033ff }
~5 Q* s4 n' _% z.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
- H4 T% |5 Y/ h6 y# W. m border-bottom: solid 1px #4e7dc1;
) B* M) D- z+ T1 M6 F border-left: solid 1px #aecaf9;
e) @& C* Y: \& g& [0 ]( Z3 B border-right: solid 1px #5679bd;
% F4 |- u# q/ P2 R" L: l3 ^ padding:1px;
. a( Y6 U4 S' w. d+ @) ?" Y margin:0px;}
' E1 Q: d& X/ F/ n0 \. ~</style>
+ f& _5 B% F+ }/ n<script language="javascript">" @0 Z- l: E; w( ?& a: c
<!--# L) J/ w2 p: }: `" K8 l/ w
function rv()
" G! x8 M: N; K/ g7 t/ |7 w{
2 }. B9 x4 x/ w" \: h; x var val="";
; [3 [5 B. g& c0 u# J for(i=0;i<combo_box.list2.length;i++){5 [- s& t; d7 r% d+ X. k) v
val+=","+combo_box.list2.value;
; ?) D n+ X4 r* [- ^( x }% d. r6 p1 u( T( g r0 n; l
if(val.charat(0)==","){# H! D+ j1 w+ T4 J5 x
val=val.substr(1,val.length);
/ @4 O3 @- g0 W1 j$ U3 J }
: b' c ]) G' \2 y& ~1 R: A' w' T opener.form1.frecname.value=val;+ \ V1 u7 U7 w. E
self.close();, d! }' V7 j/ y5 Z2 U
}
. S! L' }& t3 F- L" f//-->
2 \1 r8 w' k0 _4 A/ S8 J/ W' \</script>; T( G; ] Y e
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
: [/ e! e7 L8 o( J0 k: t; N G<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
$ c3 D U2 @" \: \( H6 ^. \) H% l8 H<%7 X, K3 `* I; z! f. N
cdatasource ds=new cdatasource(); //数据联结bean实例0 H3 I& q$ `6 i; ?8 }* u
java.sql.connection conn=ds.getconnection();
7 U6 h" `% _4 N: Q java.sql.statement stmt=null;: G7 `5 i2 v( `/ @2 _) ], _
java.sql.resultset rs=null;3 S- o' x) P' n7 ~# j) b5 m) t( @
cdatacheck dc=new cdatacheck();
/ c; G. p/ [2 T U7 D4 ]%>
" ]3 r) W* A$ ~1 N+ n( Q<%9 A7 h# _- K5 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";8 v3 o4 h. f4 x* [- z7 B" d
stmt=conn.createstatement();2 b9 [7 l% M5 z2 n; G; F
rs=stmt.executequery(sqlu);. z) D: n T% J3 l
%>4 a/ P2 U/ }0 ]
<script language='javascript'>* p6 E% Z" q! S) h0 ]5 L9 n- ?
arr = new array();7 b; m5 Y# V: X2 V- @ |4 @( n5 T
<% int temp=0;
8 J$ w, J7 B" Q) p2 u: Vwhile(rs.next())
! I8 V9 g& C% n' p8 B% t{
( |/ ^- e& O- J& d* k3 F6 T9 U+ P. `%>: w! Q: h, N9 Q" u& W
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
. d- w& k0 F6 g# i% x0 X7 p& [) O<%3 Z9 d9 H1 ~% c* p* K
temp = temp + 1;7 B; D9 S' K/ W7 b( w
}# L3 q7 v' v( ^
%>
) |; j) [: t- Q! k/ {5 }temp=<%=temp%>;3 O; \" i7 ^1 A4 T
function changelocation(id){
5 \& Q1 a7 S) o% S" \4 T7 y, u% Xdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
, D3 |2 o3 k9 V% u" ]+ o+ l$ K/ [. qvar i = 0; 9 q2 ~+ x7 u5 o8 ]
document.combo_box.city.options[0]=new option('-------','');
9 P" Y1 x3 }& c8 p2 Nfor(i=0;i<temp;i++){
. e. G6 `. b6 I; ]: i4 N, Hif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
6 i0 v9 w/ u8 e" f" a: d hdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
1 d( R4 H" ?, U2 i O1 p0 x( h! ~} 5 D+ ~- R0 R7 N' e* }
} 9 [- ? d4 m) U+ m
}
1 ^" {" J' o" v. ^( f: Y$ y0 B</script>. S' P7 m$ @" g$ k& s
! e+ Q5 A" U2 ~; h- C0 W1 [<form name="combo_box">+ U" ^$ f5 V6 s$ X2 Y( X
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
4 m" K4 r; q7 T7 H3 I' l3 _8 g <tr height="24">
1 h9 `- r. P& V1 \# @# a2 D <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>0 D. H5 `5 P, c. I" Z# _" u$ G
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>) y: i6 q; o- h; s/ L' ]% g9 k; ~
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>7 n: d5 ?+ }4 d, p) [- }; T
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>1 V" ]( k: Q* G
</tr>; X7 C, Y. E9 l) U% e+ A
<tr>
/ u% i6 h1 H1 A6 P4 [ <td>4 d$ z j0 ]( `; Z
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
: p6 t! b, y# Z! g' ?( I+ J- V <option value="0">请选择部门 ---></option>, B9 u' p- Q& U* n% h% \3 E3 \5 W
<%: I5 K, s, c4 [- K
string sqld="select * from tdept";5 s/ X- S& {4 C' h1 ~
stmt=conn.createstatement();
0 |; b- d7 N. Q& q; q; ?. a8 Brs=stmt.executequery(sqld);9 X/ t0 g* X( J. V6 `2 x" S
while(rs.next())
9 o# j! y% n5 y{
. U; Y7 V! X( s# Y; e%>0 Z+ R d/ n: E5 V. r3 G }
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
# I; w. [' }; _- b; t<%& Z3 T+ {% I) m
}
$ k [9 O# p' h8 e6 i' j. w, W%>
( f' e: q' L, h. @$ ~/ y8 |2 G </select>8 D+ i: e- ^( B( ]) `, c4 B
</td>8 V9 }9 H9 T* h' s k9 H
<td>% I) F/ o" d1 S5 H$ _2 X
<select multiple id=city style="width:150;height:200" class="bgc">
# p* K# A( @, P8 N </select>( K6 ^& Z4 y3 o
</td>
( ~; O* Q. ]! \7 W; G <td nowrap align="center" class="bgc">+ b! q& w7 K( B: O" e& Z
<input type="button" value="<<" class="buttons">2 r5 z# N; z, Y( X' F5 m( B
<input type="button" value=">>" class="buttons">
$ E* @2 h$ t% y& ?0 G0 y% H</td>! W% k6 N" P3 Y" E, J" b; e% @- S
<td>
* W4 o) K" y$ E! g <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">& J0 z% a6 H; s* d9 ?
</select>6 Z( d8 V0 @" B! g3 y
</td>, d4 m. }8 n( v8 b* k
</tr>
& R6 \+ J" B/ b, G% v <tr class="bgc"> $ }' D8 \* M2 g# t/ B" F- i! o
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>% V l3 c* ?+ q
</tr>
+ w+ W3 S& i7 F: r6 M% C</table>
2 _5 [4 H9 k. T9 E# d9 x</form>
4 j" g& e! l4 t<script language="javascript">
$ s: \0 r; i0 j* f# N1 G//人名移动0 z- Y; K. y% {. R( Z( @
function move(fbox, tbox) { m, f2 d( K) l% F; v9 w( P& \
var arrfbox = new array();8 S' ~- s! j3 M& A. v
var arrtbox = new array();& e! K M# ^+ i# n# ]* M& D
var arrlookup = new array();3 K. A+ r6 B7 l; v9 o) f! b
var i;
+ o) n5 T" b1 L: Z; V9 f/ u/ G$ {$ nfor (i = 0; i < tbox.options.length; i++) {
; U7 K3 Z8 ?, `3 z9 jarrlookup[tbox.options.text] = tbox.options.value;
+ w& Q* b% [4 Rarrtbox = tbox.options.text;
0 j/ K2 T0 ^. k( @; J% _}
; e, o( I. P, g( z1 avar flength = 0;; ]- K1 F6 V' A6 j
var tlength = arrtbox.length;* @# _; E( W" i! W$ X |$ c
for(i = 0; i < fbox.options.length; i++) {
9 F: J5 ^1 ~4 karrlookup[fbox.options.text] = fbox.options.value;
. T1 V) U w. l3 Aif (fbox.options.selected && fbox.options.value != "") {* M2 }: C7 L& G% J" X7 A2 t
arrtbox[tlength] = fbox.options.text;% M8 E) L; V% ^$ P
tlength++;
" }$ e. B! Y# A$ o% E}
) E. w) D5 Z/ C8 v) q0 Aelse {8 j5 Z1 x$ W; E( D# H! P: A
arrfbox[flength] = fbox.options.text;# t' O- p7 |0 }' [4 R7 |
flength++;, n H5 {! M* c# @2 R
}
0 c1 O+ x3 J9 f; e W9 S. p}7 Q3 J0 F6 l/ B! ^! J; c' v
arrfbox.sort();
+ `3 U! n, X6 J: Zarrtbox.sort();' \/ P; g3 n/ l
5 T" Q. y# D% w* X0 T- k# F' ^fbox.length = 0;
9 Z9 j+ o& K: ~' e3 `/ h& }& ytbox.length = 0; A, |& \* x4 p; o
var c;
* c2 ], e+ ]1 i/ F6 U6 u2 ^6 Ffor(c = 0; c < arrfbox.length; c++) {
( n% I) y5 u! D1 _5 I0 }var no = new option();
! \8 |+ o1 j/ J/ ono.value = arrlookup[arrfbox[c]];
, R* L" a) V6 D& B1 M" @5 q2 wno.text = arrfbox[c];% [- ?- E) L @8 c# {: Z- i- [1 q
fbox[c] = no;$ c8 }% Z' l. C/ P; P
}8 g9 j0 Z" P. o1 c( w6 s6 f9 m
for(c = 0; c < arrtbox.length; c++) {
2 i' ^# Q: W ~& N6 Kvar no = new option();
# z8 ~( P: _4 y/ D& ?4 N$ ^ ?" ino.value = arrlookup[arrtbox[c]];3 e7 G& U" H( m& ~$ ^( z/ [
no.text = arrtbox[c];* F; g! f, o; E. D& u8 A
tbox[c] = no;
. ]- b `# F4 i; y# D9 v6 f3 f9 j- E& i0 Z }$ B5 p5 N+ R. @) j( r
}
8 c& V# Q8 s( c+ r" O8 N2 o</script>6 n8 z+ I: |& N( Z* N; Z( k2 F4 J/ d) x1 }
</body>; G* `2 u) q5 K4 _" p. `
|
|