|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14479
- 金币
- 2525
- 威望
- 1647
- 贡献
- 1473
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"% Q' a' @/ `, X, b6 G$ U- T
c pageencoding="gb2312"! D& v1 r3 y8 a. ]) J% \
%>, j/ C: q5 W& `
<style>5 L @+ Y0 x6 {6 w9 A. t7 d
.f9{ font-size:9pt; }; M7 n. l( W% z/ R* U1 j/ M
.bgc{ background-color:#aecaf9; color: #0033ff }) h" c/ B, Q/ Y! `8 H* A: M* P
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;2 m: i# J6 Z( X, b5 C& E5 R
border-bottom: solid 1px #4e7dc1;' i; E3 }2 y) |
border-left: solid 1px #aecaf9;
' S, l; O% e$ k7 A0 c" l border-right: solid 1px #5679bd;$ A/ z) q% ?" I
padding:1px;- m. v7 n+ O1 ?3 _' M% V2 P
margin:0px;}/ _" @% C, V. x. F
</style>8 `( F$ c$ f) n. t" T2 v M
<script language="javascript">
" M. D1 w; D6 D/ q( j<!--
( d3 S8 T! t% m9 d4 P: Wfunction rv()
( `5 o, ]) W; p4 a4 c{- s# i, o Z% @& S; j) h4 q4 J4 G$ I
var val=""; J# `4 s) n1 P1 a
for(i=0;i<combo_box.list2.length;i++){
\0 W0 U7 w: U1 \5 H) h: P val+=","+combo_box.list2.value;' O: K. F' m5 l* d6 e! w4 O
}5 M' q9 E W( d: ?
if(val.charat(0)==","){
# T Y" N4 [4 H0 {6 v val=val.substr(1,val.length);0 h0 h2 }# P& _- r+ M: H
}: z4 \6 {& n W& Y! x% t
opener.form1.frecname.value=val; `/ T8 g# f" L3 I1 ?; j+ \
self.close();1 Z+ G0 ^. `( f6 D# p( [
}& p, e+ J. L: E# A3 j+ P
//-->, _" B7 Z8 O8 r, h, |
</script>5 z! f$ {9 Q* \8 k& \2 H5 x
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
" |! X+ `. M4 n6 Y' `# A<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
) r2 Y& b4 e" h2 D/ ?) P2 n<%
' ~2 o, f% v- e* {) O' I3 n; i cdatasource ds=new cdatasource(); //数据联结bean实例3 i8 e! z; I+ U2 Z
java.sql.connection conn=ds.getconnection();; d3 n. t1 X: s: v, b
java.sql.statement stmt=null;' b& X5 h5 ~8 g0 G! Z
java.sql.resultset rs=null;0 Z6 Y9 W+ s' K1 [8 \* R
cdatacheck dc=new cdatacheck();: U4 c R$ j+ \: @
%>
: z+ ?. i5 u9 T" y) l3 l<%8 C" c) f: P- V" W
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"; `+ c4 ~# k; k) D9 `+ {
stmt=conn.createstatement();
0 @6 O& j ?5 R& ~2 K! [rs=stmt.executequery(sqlu);
& W8 N3 \( @) x( C& u+ W( V1 t% g%>% p( I; ?; ~: P/ }0 O
<script language='javascript'>% N) }6 Q* v+ c7 P) P
arr = new array();* s+ h. B; B% h5 b, G- A& k' {7 {! [# c* k
<% int temp=0;1 u7 _8 {, g0 M, j" M
while(rs.next())
7 Y/ h: F2 I9 A6 B% _9 N{1 O) G! l& k/ S% g- }: l
%>
* Z# s7 w9 }, V% E5 marr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
9 W; J! g& y% S- V( a9 t<%4 c+ G, C8 W1 F3 y$ o8 J- p
temp = temp + 1;% B; Z0 t: Z d
}
( w. Z o* G! m" ^1 M$ g%>
- E% m* a6 Q& Ctemp=<%=temp%>;
( L; ]. T' }- X: [& L6 l3 F' ^function changelocation(id){ 9 G* E# V$ k* W# P' U9 R/ J5 M6 z
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
* v- Q' Y. c' i% J; D5 Svar i = 0;
! ~" v/ {1 o; |+ Z7 d9 W8 Ddocument.combo_box.city.options[0]=new option('-------','');
$ Q( E' d6 Q" W; qfor(i=0;i<temp;i++){
Q' l3 t6 N$ J) ^! c3 gif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
. i' S2 i+ `7 e+ l$ f5 q! |4 z# P3 Xdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
) W& a3 e |6 y/ ^}
4 [4 p4 {8 M( L* P7 d}
0 w4 f. A% H/ e}
. p" r0 q7 t Y. e# [4 z% K9 S) P</script>+ l, d- A# O1 y# K: U2 v
|7 A* K: J- i- z7 d, N0 |0 D
<form name="combo_box">' Q6 ^) G: V4 |# ~) a1 O" e0 c
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">! B7 z: k- s/ S* P! [ [
<tr height="24">+ d/ h" Q1 \' a# w# w/ ^1 h
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
7 J; ?) z6 ^- G4 U <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
( ]4 `( L9 D: f+ v5 k e2 f8 d <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td> T5 K+ G( e! V* ~: l% {+ q( n
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>* Z; Y( `% N( |8 M) O9 Y' I! X6 n
</tr>
& M. U3 g# w5 `# n6 H <tr> & \' @$ [' c' B. q. @
<td>. R: ^% {7 W( H& a; g" ], L
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
! K( g& [4 V# I# m+ ^7 z7 C <option value="0">请选择部门 ---></option>
: F6 i- P1 _: o" a) N2 }, N6 K<%
$ e$ i8 K* { b# _7 _- D string sqld="select * from tdept"; [1 Y, N6 N2 e/ ]1 L6 a5 A, [& E5 j E
stmt=conn.createstatement();9 D0 `/ z# Q E* r5 S! B) q1 P
rs=stmt.executequery(sqld);
8 P* t9 p, ~# O G. V2 Y7 L# _while(rs.next())2 Q5 C- F+ m2 u2 m
{
+ S$ w6 I* x- t+ i6 d. c, |+ N6 v%>
' |* x1 F) Z3 o* H9 v/ Z6 s <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
: U0 V( W. s( Q% l! i; w& I! V<% t) I8 F6 c: o$ f# e' S! p% J
}
! P f: X3 K) X/ r. x- D4 \. K%>
! j" w* c# r* @$ S </select>3 S6 ]) k) C- Y/ i- q
</td>4 b: Q# E3 y* w; q+ {! ?2 j, X
<td>
/ I, W: Z8 {, Y$ X <select multiple id=city style="width:150;height:200" class="bgc">2 C, Q8 y5 @! T% g0 B
</select>
T/ |# O: l. _. a9 ?! {4 c* k) [5 j</td>& N3 D$ D: s; x" i; h0 h
<td nowrap align="center" class="bgc">% M+ T5 N! u& M! {& H+ j% _
<input type="button" value="<<" class="buttons">6 T+ b: L2 N) n& N/ {5 s& P% c
<input type="button" value=">>" class="buttons">
1 ^/ Z0 @2 ^- }* n$ a</td>
& x) E) U+ ~0 L; P2 ~+ Z <td>. R$ Z0 |' l1 G7 R( v% O$ r
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
* E5 `7 R/ D) v: ^, l </select>; W/ f" u0 @" f# n; D% k$ O% Y( b9 A
</td>
: X# z, G9 y% B7 n' ?& S/ ~ </tr>0 q, P- R# z. z2 H) d7 v
<tr class="bgc"> 6 c1 x; L; Q( `( q3 o+ q+ J- U
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>( i0 R7 k* z& L, ^2 I# ], \( z
</tr>
Q7 ~% z) A( j1 Q0 ?, }% y" c, {</table>
2 o: g8 `9 O3 C" b- v" h W7 {</form>- o7 x, P' Y1 u+ z+ P: m+ x
<script language="javascript">
( a: {3 J7 L0 q, I* ~5 H; J0 U//人名移动* i: g. b% O7 k3 Y
function move(fbox, tbox) {
) O' }* }4 v+ @4 zvar arrfbox = new array();- T, t9 }# `. |- R* b$ W7 u! q* D& ~
var arrtbox = new array();
) B( S$ Z+ y3 v7 Z) Avar arrlookup = new array();4 A$ B/ d, v/ E6 E" _- T( y4 M
var i;
9 G+ k7 W n% Y; z0 [6 k5 {. P/ afor (i = 0; i < tbox.options.length; i++) {/ j! {; L7 |5 v
arrlookup[tbox.options.text] = tbox.options.value;/ L% i- ?$ x/ P0 L) J) W6 H
arrtbox = tbox.options.text;5 N& K1 ]& ?4 u# Q5 H* _' ~; L9 v/ m
}5 X: F' T ^9 A" j5 g
var flength = 0;
w* ^ L5 c4 T4 C7 i& Z& ?; }var tlength = arrtbox.length;
1 A1 I. g* K- z r+ ~for(i = 0; i < fbox.options.length; i++) {
0 `8 t1 T5 Z. u5 d/ d' v' u2 Oarrlookup[fbox.options.text] = fbox.options.value;
. G3 P" s, K* H+ |0 N$ P4 kif (fbox.options.selected && fbox.options.value != "") {
2 u- T$ ]! c+ N0 ?6 Varrtbox[tlength] = fbox.options.text;
: j1 E F& W$ j1 g h3 b- Jtlength++;9 v2 F: c0 B, D$ c# X
}
/ E9 A) d& U; r# P7 aelse {8 g( c& k& I" k2 M* U9 ?! |6 p
arrfbox[flength] = fbox.options.text;
) a5 @- y3 k' {$ d! G# X& Fflength++;6 b! h! s8 c) F) v
}
4 V( B4 h5 |0 u( z- h# P& ]}
7 d* @4 e2 {; T2 A; Z) z P3 W9 Zarrfbox.sort();
1 q1 T* [6 F- Y; h# \ }2 narrtbox.sort();
7 ]' |) ?) b( U2 ?) \" _- h- u0 h
. U/ l& x: ^1 R; G! {; ~% j2 Q8 qfbox.length = 0;5 d5 H. n5 k" R6 e( o
tbox.length = 0;$ G4 Q. }4 X4 Q' z; t4 {9 {, E4 M
var c;
/ b2 J s% B7 i5 E6 }7 v/ a8 Wfor(c = 0; c < arrfbox.length; c++) {7 T4 b8 X) x f' t+ ]/ S! f2 p
var no = new option();
+ L+ D! `) n7 F9 `% ^6 Bno.value = arrlookup[arrfbox[c]];
/ K9 R, ?" ^. B1 q+ o H9 s# pno.text = arrfbox[c];
@& o& l2 M/ Qfbox[c] = no;- G7 ~8 U; ^% R7 l" j! Q
}
- N. ?# o( r8 C% S- `for(c = 0; c < arrtbox.length; c++) {
m ]* j4 c. A" dvar no = new option();
9 X+ u2 @- t9 q4 l' ~) ano.value = arrlookup[arrtbox[c]];
D- z8 t/ w" x( l+ Ino.text = arrtbox[c];
3 C& c" U" K5 Otbox[c] = no;
$ z4 J" q z- `! C }
" r* q7 ]! S7 s/ `) ?; }" I) g5 d}1 O4 y' H% N$ [+ y) J3 W, ~
</script>" Q( Q& \# k2 S3 S$ s# G! x( b
</body>
! B+ I1 k: W4 p$ h: z |
|