  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14221
- 金币
- 2401
- 威望
- 1647
- 贡献
- 1349
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"8 E9 m$ b4 v9 P% K
c pageencoding="gb2312"
$ H* E) j5 {. e2 K3 [4 O, F6 g% ]%># O6 S b v1 `6 a% @4 v) P8 W
<style>: ^( Z6 B/ F7 d# j$ v
.f9{ font-size:9pt; }
5 i% p: y2 { s; f5 C( ~ B.bgc{ background-color:#aecaf9; color: #0033ff }/ p! [: B: g& [- W
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
( q; Q- u/ r( H0 P$ ~1 w" e1 Q border-bottom: solid 1px #4e7dc1;
- G! y: R; @& T( k border-left: solid 1px #aecaf9;6 w, t. O& A# I9 f
border-right: solid 1px #5679bd;
6 u! @: V, Y/ w0 o1 k8 r0 T9 F padding:1px;' D1 V, p( W' B" y( \8 n2 `
margin:0px;}
. |& \+ b8 w7 f8 j</style>9 I/ L$ l' C: T6 u, r2 w
<script language="javascript">
9 f: @# [- B6 m. O# p<!--1 L7 d9 j# l9 B! Z/ R3 ^
function rv()
o' y& R! C4 U5 x8 {$ }{, T' ^8 u" H3 F; ^; h/ y
var val="";
/ o" R/ S x. N* m: _: H' R+ W: K for(i=0;i<combo_box.list2.length;i++){4 D0 p$ ]2 Z3 [
val+=","+combo_box.list2.value;
/ W; H: J7 C$ S6 r6 c/ m }
6 H" [) w) l) W& |4 W3 w3 R if(val.charat(0)==","){
9 m$ q1 y, s& M val=val.substr(1,val.length);3 k/ s0 C( i- L9 p( P, }- \' r
}
: N+ W5 f w m. t- L% i opener.form1.frecname.value=val;
5 F0 v' a) M+ _ self.close();9 Z9 N& a' m& k4 V8 `0 i Y0 f
}
0 Y* b; @6 j7 R% k//-->
: K- H$ _) m, t& D</script>
' @; ~; A3 B6 I' u, g<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">6 T4 s9 N( ]: u/ M0 v5 s& L0 I [- ~
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
" ]' o* p+ c% V' }2 H7 S0 K0 l<%
! \; ]0 W1 F& q* _( \ cdatasource ds=new cdatasource(); //数据联结bean实例
5 H( c' z5 ~6 V1 B: K q java.sql.connection conn=ds.getconnection();
% a" x7 H) N8 Q3 x java.sql.statement stmt=null; `# T4 k0 z0 [
java.sql.resultset rs=null;
2 c- N; [% C: `; g) ] cdatacheck dc=new cdatacheck();4 t4 k) N' ~+ L' ?5 Z! p
%> M" J3 w8 [( O. _( B0 x# Y
<%6 t2 ]. U' Q" {
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";
2 Z0 F3 N5 H$ y1 Vstmt=conn.createstatement();0 E) Q% \6 z( Y
rs=stmt.executequery(sqlu);
2 C4 N4 d* L+ l$ P, K; n% y2 y%>
! e* {) k- X, E7 f8 i# s. G: D0 f<script language='javascript'>0 m3 G4 [" G; C
arr = new array();# t e; } G7 Q3 B8 _- `6 n2 R2 n+ H
<% int temp=0;( U! G( Q7 B8 ?8 h
while(rs.next())
4 [, X1 v- }2 a: L N8 P* P. D. n O{# h' h- m/ K- t) u- W# }! i
%>
{, B* l- _ h1 }; \5 Aarr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");' p1 X+ k. D+ P5 B
<%
: C4 o; F0 c: jtemp = temp + 1;& z/ T7 v* v0 g( o
}; h9 g/ y G+ r/ @' W8 q
%>
2 H+ U: z5 \3 ~temp=<%=temp%>;
: @$ T- A' v( w. i7 r0 A* M! L0 f! ]function changelocation(id){
! e/ K) D+ Z# ]: o8 _document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 , S( y' {+ }( [9 A$ I
var i = 0; ; X9 t9 v7 x6 a
document.combo_box.city.options[0]=new option('-------',''); 7 l- u6 i* l0 J: J* t6 z0 ^9 w0 ~0 a
for(i=0;i<temp;i++){
# n" t+ t' b( g/ ]) Gif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] 5 b: F' q4 }* J9 I2 O3 t
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
/ Q9 D( f# [: U; U- J' @: a) G} 3 j. {3 N6 ~3 h( C) B: \
}
% f2 m+ h+ x7 |" n7 J}
5 B0 I' H3 m! ~( A- }+ U</script>
7 {1 y& y1 h2 E& m( ]8 L2 k
5 n7 `: e) G' e! T<form name="combo_box">
% V+ M; c6 q8 i<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">6 d7 n3 g, ^: t7 F# C
<tr height="24">* U5 z3 C; Q# c g3 R' R- e
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>. n6 D6 x+ N1 Z6 d
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td># a0 ]' m, ~) W# y0 H; m
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
% ~0 k" j+ L2 N* d <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>6 B; i8 h0 ^1 K/ Q1 }# R ^
</tr>; \% i: h+ U& }3 e! o
<tr> 0 S7 R/ S# _& Z# u+ U8 B) |
<td>! F( O5 b( f) j6 O4 H- J
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc"># O3 N; f, f0 W+ x
<option value="0">请选择部门 ---></option>
& n) z! B" R, G7 ]" p5 m. g J1 v<%
9 H! K) ^8 q2 e9 f# B string sqld="select * from tdept";
' w z4 S6 I) ystmt=conn.createstatement();; P4 R: E5 O' t4 K
rs=stmt.executequery(sqld);6 _2 o' b: Q* A% G x/ m/ f
while(rs.next())
8 c$ Q* f& q' C- K. H$ c{5 L5 x& I E5 z8 P
%>
9 k: w' ^# U" \2 S9 a <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>: t* L+ f" |/ {2 M4 l
<%
6 v/ O6 a4 C, a* G}
! G7 `7 D. z9 k8 @%>
) A) i) y# Q, V3 o& Z </select>
9 D" A5 ?" I% K4 ], T6 n# |</td>
# P# W( S0 x# ]: a" Y8 J4 ` <td>2 w3 x+ ]1 A w5 V
<select multiple id=city style="width:150;height:200" class="bgc">" G4 [ u* `2 j+ X$ \
</select>
+ r% Q. v6 x/ I. f# J</td>
H) }8 F8 i2 w- E+ P { <td nowrap align="center" class="bgc">- D. w- W9 H. u2 `
<input type="button" value="<<" class="buttons">
& S4 `- e0 S4 F& x# g- {$ E5 c <input type="button" value=">>" class="buttons">( C1 S+ |+ c3 Z5 k3 B6 |
</td>
x5 a3 d6 R" ]) W <td>
( F* x5 V2 z/ ]4 X6 v <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">! W: A+ b- `0 w/ z f' y
</select>! l+ f( R0 o* H% J& h( A
</td>
3 x8 s+ L0 Z9 `5 o </tr>" V# k8 i: c, N1 r- ?: g2 o( s
<tr class="bgc"> # | A4 y" o5 F4 i# L
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>4 c3 {7 C: H b e1 \
</tr>
$ F. @+ v5 P/ B( M6 ]$ s; I</table>( O1 o7 T% K u
</form>
/ @/ |( z* f9 m1 w* T, V. Q<script language="javascript">
" l+ `' J$ v8 S1 D* T; M& j: p+ u, c//人名移动8 r, c$ {! q' s$ u
function move(fbox, tbox) {& U2 K; `$ F' r+ O+ `) [
var arrfbox = new array();) l9 Q! y: }8 ^& H8 P0 s/ Z
var arrtbox = new array();7 K1 u* @' Q | h$ o+ |
var arrlookup = new array();
, U1 K6 J" t7 i( h: Tvar i;
: \1 _! c! x; a/ L% o/ L& N7 ~for (i = 0; i < tbox.options.length; i++) {! Q! C" y9 |. v
arrlookup[tbox.options.text] = tbox.options.value;
% j7 ]- R; k; Zarrtbox = tbox.options.text;
`6 R8 }0 y2 G4 t+ j}
% h2 F& }* L8 s$ Avar flength = 0;0 y- B# N8 N6 O5 T
var tlength = arrtbox.length;
: X+ v" F* N: m5 J; o5 @ \for(i = 0; i < fbox.options.length; i++) {7 @) a _& o6 j, s* {7 i: Y( E
arrlookup[fbox.options.text] = fbox.options.value;2 ]" f- o; T8 d1 c
if (fbox.options.selected && fbox.options.value != "") {
4 W- c4 ]9 e( Parrtbox[tlength] = fbox.options.text;& ^7 O' X. g7 m4 I+ w" G
tlength++;
$ y# {$ E# F6 a: N3 n7 E* g}
' X4 z# A& p+ s8 C. Z4 Eelse {% y+ [! H6 H, p) E. C3 `' a
arrfbox[flength] = fbox.options.text;% V }4 S3 v# e& ~8 @8 E( b
flength++;8 `" _! Z( k' l: m% m
}( ?% D% t! S" g8 {$ _9 x
}0 O% Y7 Y, @7 G6 r: B t
arrfbox.sort(); j* g& p- D/ P T" _0 N- L9 J
arrtbox.sort();
9 X5 x+ e' N! L6 T2 \% s `
& D! }# y4 i2 afbox.length = 0;
/ R, Y7 H; }4 r+ w6 ]+ O; }tbox.length = 0;
' W w4 D7 @6 Z) o& ]* m/ J7 N5 cvar c;
- S- r* _' U( s$ |/ J6 Yfor(c = 0; c < arrfbox.length; c++) {
/ _4 l2 _; X; f4 fvar no = new option();1 Y! a5 s" u4 N3 L: b
no.value = arrlookup[arrfbox[c]];
: W. Y2 M2 L* o; u/ ~- ?6 H* Ino.text = arrfbox[c];
2 |) z3 |8 G+ [" i5 Z& q+ hfbox[c] = no;
I! d& n( n+ K}3 }# d. ]/ y! H5 F8 a$ a
for(c = 0; c < arrtbox.length; c++) {1 Q w3 r" |- u" |2 O5 z; K$ w; J% a P
var no = new option();
. }$ n3 I) r. M& _no.value = arrlookup[arrtbox[c]];) q1 V) p5 U# h" u3 b+ m% T
no.text = arrtbox[c];& B- E h- P. t: `
tbox[c] = no;% M4 v/ u; c, ~( b& g( c) p
}
O3 G) R& a: M" Z# f) c1 `}5 n& L3 k3 t9 t/ D: z
</script>9 V' u$ M; l G: p- ]2 M7 Y0 C
</body>
( i9 t; ]: w i; A. E |
|