  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14171
- 金币
- 2376
- 威望
- 1647
- 贡献
- 1324
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
/ n# u/ f0 {9 K2 B: f+ _# Y c pageencoding="gb2312") ]2 o c$ ~' a- h, C; `" f
%>
6 B0 B0 ^/ g! B. Q( v<style>; [7 |+ G7 Z: F/ y
.f9{ font-size:9pt; } Q. N4 e6 M E, A: R H: g' S. e
.bgc{ background-color:#aecaf9; color: #0033ff }
0 A$ U& I: \7 m5 y$ l/ Z.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb; j' ?+ p- [/ G7 r' r
border-bottom: solid 1px #4e7dc1;6 f, W4 S8 y# L. ~, _2 T7 i
border-left: solid 1px #aecaf9;% y4 [' V( X! D: N4 ]. @& O
border-right: solid 1px #5679bd;# B7 o; f. j* Q. l X. F( B# h6 q
padding:1px;; _6 e) G% V/ J' t2 H" O( H
margin:0px;}( M1 ?, u! U& t2 J# r4 }
</style>5 U' f/ J/ H4 b9 l
<script language="javascript">
' C: O6 S$ Z% j9 ^+ t( Q) z<!--) W0 {. v- R, J- M2 h
function rv()
; K7 b5 _5 @1 c, R' N{
d1 g' d4 G( b! H3 e- u o var val="";
7 d9 R& h$ {& g: i7 @ for(i=0;i<combo_box.list2.length;i++){
' z: J* X N7 H# \; \* n6 z/ A& v- J val+=","+combo_box.list2.value;
6 h w6 c$ h* g1 r2 | }1 N! n/ y$ h: J9 o% e! z
if(val.charat(0)==","){
" \9 h1 N( z" k" q7 V' P val=val.substr(1,val.length);
1 w2 B+ F) P1 \* Q6 Z }
) S4 X6 e9 \% ]4 B# q opener.form1.frecname.value=val;
6 V3 ?% Q! E8 N. h# e self.close();! [' W& U9 D& C
}5 ^2 G0 o- l `$ r! D+ G
//-->) v, D% m6 s7 s0 B( x
</script>: d5 _% V% d9 n& X
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">+ Q/ O1 f! |+ V3 K0 _0 Q
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
. N( Z+ v- g5 K$ a% R<%: j8 t3 }1 B6 Q2 S$ |7 g
cdatasource ds=new cdatasource(); //数据联结bean实例3 G/ d3 q* G* }) R/ j; d
java.sql.connection conn=ds.getconnection();) g' s9 Y" c: N: e
java.sql.statement stmt=null;
7 \2 L" Y( c' r java.sql.resultset rs=null;
! |$ a! {, m9 M5 W cdatacheck dc=new cdatacheck();
! V9 J' n" k. u; M! S7 j4 |3 b8 L%>
% ?9 G# g& [) a<%
0 H) t2 m! q' ?4 ^" ? Tstring 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";, N4 y8 _. Y/ \- t; G' k
stmt=conn.createstatement();4 U7 g& W% H3 f# K% o6 L
rs=stmt.executequery(sqlu);
1 d- I" [1 N/ m. t0 V; T, A%>; s7 K- l1 U: |5 ]+ [. N' ?$ e# V
<script language='javascript'>4 `. g. a2 j3 V0 s% q. h
arr = new array();
1 A: P* V5 i5 k+ q! H8 O<% int temp=0;
9 u( I$ B3 O$ y/ m+ \6 Dwhile(rs.next())) o/ I( I. q, j1 V
{6 d- s- r4 i q% ]
%>4 g2 p+ d8 ^- L6 E
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
! d8 C3 V: B. T. M<%
8 t B( W+ X$ x7 J5 ctemp = temp + 1;
# K- {; @+ Y A3 m}
* O9 \0 }- B+ z0 H6 s%>
: X) S7 H, e& A9 Ytemp=<%=temp%>;
: H) [$ y) n( X8 v" jfunction changelocation(id){ . w4 G' ?2 M5 a8 K! j8 H
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
! q" \8 W3 K0 ^( dvar i = 0; & v3 m# D# k2 v" y4 a2 ^( m z
document.combo_box.city.options[0]=new option('-------',''); 1 a9 F1 z" M0 L
for(i=0;i<temp;i++){ % M% P# O% N' M3 H9 d
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] : Z& ]* d- Y) \# X* r W3 r3 O
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); 9 Z6 i' O! @; S, c4 T: g' P
} & H, Q) ?% ^9 y) C" B5 l! x
}
% |$ b0 H, W$ P) D9 o7 m5 h} 4 V4 l6 X5 Z4 e% [( O: \; o( V
</script>
8 w; G! b( x% Y+ j6 |6 e' u0 E3 `" S* R! M. w% {6 q
<form name="combo_box">4 |* O; ]$ C) V% c
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
! @& l& S4 `3 k; \8 b( f <tr height="24">. b4 F6 S" X9 c7 @4 N/ J9 h, V
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
9 g4 b6 Y' E' `, v! k <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
8 F' z3 Z& [+ {, x4 @( R <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
! N1 z5 D$ T0 `- v <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
, o b; V; H- w. K; I </tr>
8 A5 Z* d$ H7 z! D0 c8 s <tr>
5 v" L, V1 H( j# T9 b( r <td>
* m( g6 G# c o, ^ H+ H: a5 O: g <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
5 W5 E' a/ T& ?; @/ e: U" P <option value="0">请选择部门 ---></option>4 H. E) K: s* W1 O. _
<%4 [1 l# N6 S8 p; C* |) `
string sqld="select * from tdept";
% L! S( U: @7 c' S* ~stmt=conn.createstatement();3 L" t* Z% l# f. A- C' ~9 N
rs=stmt.executequery(sqld);( l0 q0 }3 ]" e) j4 _4 {) h
while(rs.next())1 U8 P3 w# I# H
{3 v8 |/ q' S+ n$ G& m3 r
%>
$ n1 s8 F' {: U( _9 `, ?) Y; J <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
- ~7 F. }8 ~5 U# b; Q8 S4 e<%1 r1 q' Y7 R% @" X' Z
}
5 m: x5 q3 S- c%> # Y0 m& Z+ C6 ` Z! Y6 R( z* E
</select>
! V- q1 P/ P" }" m</td>
! a+ n# s7 U$ _- A <td>
+ z! s F5 h4 P) W4 F <select multiple id=city style="width:150;height:200" class="bgc">2 u+ s/ @: H- U P; J' W
</select>
! i/ m! ?' @$ W7 M1 H</td>
% x8 Q' Q- R) h. g! _( j <td nowrap align="center" class="bgc">
W8 @+ s7 M* e) l, s <input type="button" value="<<" class="buttons">
3 r7 z' X% F, q4 j( D0 S <input type="button" value=">>" class="buttons">
. I6 N; z* C+ r& R* F, v( O</td>
, k$ `; t! |$ { L5 i5 H: O- w <td>7 K+ ~- J% M8 [4 a5 n* q! W
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">0 ~ X4 f! o, a/ E( q9 {
</select>+ K# O" w, y- X1 p7 A! \/ Y5 M
</td>9 z$ g. B& p- K6 I
</tr># D" l: B: I5 ^8 k5 g# D
<tr class="bgc"> ! l# [! }$ i8 k2 V
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>2 y6 C, w- ~9 K9 j ~7 L
</tr>8 c! e5 F2 d, A+ V3 F0 W1 T' @ I
</table>
7 y1 x# `4 T& L</form>, F2 D l" U* H# J. Y% I; u
<script language="javascript">
& @" A/ Y; a* @( W1 ]$ o//人名移动) ?% c$ M$ Z* h R% ~
function move(fbox, tbox) {, U5 W7 L9 `. M/ i/ `2 F
var arrfbox = new array();3 c+ [0 N' Y6 }% R0 \& ^
var arrtbox = new array();4 h/ k" y3 H1 V3 k! m: N. }' h$ t
var arrlookup = new array();2 m" e0 \0 N7 Q" U2 f8 |) U
var i;' r& t* F0 x* P+ T+ h1 x' Y
for (i = 0; i < tbox.options.length; i++) {
: V% T3 y* c$ Q, c) d6 i5 ^arrlookup[tbox.options.text] = tbox.options.value;5 c/ ^5 R, h) \: Z. o- f
arrtbox = tbox.options.text;
- ~1 L; p+ B& Y+ C; V( m}
; @$ }0 S# P- H' g$ svar flength = 0;* r# c# }0 M' V* h; ]
var tlength = arrtbox.length;' D4 \+ o& B) k8 j
for(i = 0; i < fbox.options.length; i++) {0 D( A+ P$ |# F- c% S+ P
arrlookup[fbox.options.text] = fbox.options.value;) a+ M2 W! f2 G1 h6 E. u n$ U
if (fbox.options.selected && fbox.options.value != "") {
1 s) B' m* L) G5 C& Iarrtbox[tlength] = fbox.options.text;
7 z1 e# O4 D- ztlength++;
0 y; m& j0 S0 ~. ^/ _% ?' V: K9 u}
# C% z4 n( |3 @8 g* ]else {
9 |- u) G( ^0 w& }; y8 C% U1 m$ ]arrfbox[flength] = fbox.options.text;
* d3 I5 m2 @3 j$ h/ B5 kflength++;
/ K: {3 c+ f0 S( `% f- e+ c }
3 i2 D$ ]2 S& _+ A- i4 \/ S}0 [8 V: ^+ }' b$ j
arrfbox.sort();8 B2 t1 C! P. [7 H/ `( B
arrtbox.sort();: u3 y' Z9 Q" W. V
9 ^% R7 G! @3 a) T [1 g t/ k5 f8 Y2 G
fbox.length = 0;
7 m+ T$ z* t1 T" ktbox.length = 0;
6 i# O1 y: @5 c2 S/ yvar c;& x# D& H( `$ h3 E* Y6 w. |
for(c = 0; c < arrfbox.length; c++) {
) V; n' T1 v& e0 vvar no = new option();
, n. i- f% I8 ]no.value = arrlookup[arrfbox[c]];
! r* J+ N/ b+ q9 |4 F' Y4 jno.text = arrfbox[c];
( S# g# I' i' s& H& Hfbox[c] = no;2 w/ }& D* i" F3 B3 N1 ~" f
}+ l2 G! _' Y6 M* O% z/ Q
for(c = 0; c < arrtbox.length; c++) {
3 F- ?$ g4 O( q# _var no = new option();, D( h- e- K" @1 w8 i9 s
no.value = arrlookup[arrtbox[c]]; t' ^+ Q3 n& c0 F
no.text = arrtbox[c];
7 K6 I7 [5 k3 atbox[c] = no;% Z; l2 T& p: G2 a5 Z, z3 r. n1 M6 T
}
: J6 l' B) A- c$ G$ m" C}7 q# W, @) {; `: P4 _" V8 R$ l6 v5 \
</script>
9 c+ I+ ~4 G' S7 x) ~</body>; E( c7 e; z* T. j5 h1 s
|
|