|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14443
- 金币
- 2507
- 威望
- 1647
- 贡献
- 1455
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"* `5 K4 [4 u3 m/ s2 {; I
c pageencoding="gb2312"
& E' P+ N4 m: Z. x0 D%>5 Z, j4 n+ n) y3 M+ y
<style>: G- C7 q5 w) [# A
.f9{ font-size:9pt; }) C, m2 {. v7 v! u
.bgc{ background-color:#aecaf9; color: #0033ff }
0 M. N$ O7 u% \2 ].buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;- g' t: |/ S7 X8 t5 b) |0 q+ |7 H
border-bottom: solid 1px #4e7dc1;
' C' U6 Y& }1 V4 q8 Y9 g" e border-left: solid 1px #aecaf9;
3 b \0 K. G6 G% K border-right: solid 1px #5679bd;
! A( C' G" U2 i padding:1px;
3 t' ^ X4 z+ ~ margin:0px;}
3 K1 ], H6 ? ]</style>: x! F- w) Z$ [ t
<script language="javascript">
; {$ M' M5 a4 `) B<!-- r9 M3 m; i; T: Y6 L
function rv()$ ?/ k- {8 w/ N; m! I# T# k: f y
{
4 S- p) U- l; {. v- \ var val="";
% x0 X# m9 i, q' V& z- p for(i=0;i<combo_box.list2.length;i++){. o$ [8 L! V9 X
val+=","+combo_box.list2.value;# U$ z# U$ e! T. p6 G
}
; h( x) d& V, G/ v if(val.charat(0)==","){* s |+ \. s3 U5 D! Y' ]5 _! Y
val=val.substr(1,val.length);" d3 c; D- S3 [+ D+ E! l
}
. H4 }. \/ _4 @2 t/ n) S# H opener.form1.frecname.value=val;
0 ?- L6 f _( { self.close();8 s4 i1 M. |+ y/ C0 B' ~6 k+ z
}; R- D0 b; u2 M9 F# e
//-->
; G2 }" \# E% O, ]' P) D1 n' I( `3 [</script>
# t9 }3 u% z/ J2 y- C- t<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
- ~5 W7 C) T: I) v( ^4 o1 ]<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
$ v6 F. e& a2 v R6 i, K<%
. \5 Z" f/ }; ~7 A: R* A x cdatasource ds=new cdatasource(); //数据联结bean实例' l' N9 n; o$ H. R7 C- q
java.sql.connection conn=ds.getconnection();# o8 C9 r# T* k/ G0 O$ n6 K' b
java.sql.statement stmt=null;
$ T7 U+ N8 q8 h9 Z7 S7 ~ java.sql.resultset rs=null;8 Z* w- u8 L8 H) [& E1 a
cdatacheck dc=new cdatacheck();. I9 t3 @" ~# X: E
%>* |; k% g4 j' E5 B2 h1 Y" x. p2 ]
<%
- y& \0 `0 \. T7 X# ustring 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 T% p5 O3 S( ]" F. N3 A! ]2 y8 }stmt=conn.createstatement();/ ~3 V" Y# `- ?& ?1 c3 C
rs=stmt.executequery(sqlu);
- l8 [, U7 g, p%>
8 \& @# _ M" G<script language='javascript'>
, S# }6 G y% L7 A: B$ n# F [arr = new array();
) V$ i) Y: |8 o<% int temp=0;
. t" x' S N) E& N( W8 r7 h" I5 nwhile(rs.next())$ j7 Z) [) e! B) Z% w+ {9 m6 n
{( _! D" Z9 D( y8 m6 T$ N& T
%>) Z, F2 P4 z( A2 l3 e
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
* K$ l5 {3 X0 W/ v: N<%
1 L: }* R1 j8 i7 |8 `- Ztemp = temp + 1;
* S" @" e9 r1 p+ {0 r d}
9 T# d6 T( k i; G$ T2 L/ A. B; Q1 {%>& [' }& \# d) U J0 [. s6 L" E
temp=<%=temp%>;
$ J1 c: }; M& Xfunction changelocation(id){ # M/ Y' N! u% `; H+ a
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
4 L1 ?0 }7 P- y; e# rvar i = 0; 6 u- _3 J+ h- G3 c: ^
document.combo_box.city.options[0]=new option('-------','');
K4 V' p! s9 d8 N8 Z1 _, q2 C6 o- Hfor(i=0;i<temp;i++){ 7 _& d6 V/ h h! d) P* W& @/ M
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] + C# w) Z0 J- j: g5 O- ]
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
) q1 U X+ D. f! f8 D} 1 G- P1 [* t# N2 H3 i
}
# W5 `* o/ T* e3 L}
9 i$ Z! @6 ]$ y4 l2 t/ t</script>, b. q9 C8 ^/ O+ H; l
( D$ y2 N% K1 y* P- f7 ]
<form name="combo_box">) e+ R$ T# O$ R% J1 Q" ]
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59"> w8 `8 i. j& P: Z3 x
<tr height="24">
3 N+ Z4 x, |& b2 N @( R7 j <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>6 s- Y$ ^6 Z& Z' s- A8 n
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>) @- `% D6 J- D' ~* H
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
7 b3 }8 s ^. p5 H <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>1 E/ Q5 j _9 _9 j
</tr>
9 x" h; B8 ?( }! } <tr> / g2 A& t1 w- u" e q1 t7 f
<td>; W: _4 w; o8 ^1 Y' _6 q
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc"> ^% u% w; U n$ t
<option value="0">请选择部门 ---></option>
+ B# P5 J6 V% l. x% Y( Q0 V0 X<%
% @5 D, \! e2 u: ? string sqld="select * from tdept";
. n7 i" J; A2 b7 R" y' x& }stmt=conn.createstatement();
/ \. q" r2 P4 Z( _* N# h6 }rs=stmt.executequery(sqld);
2 x7 i! k, E5 k( q: ]6 E2 Kwhile(rs.next())4 b G4 ]; E0 a7 J' b+ x0 I1 ?
{
9 Q9 U2 I9 y5 d! G%>$ L: f+ i g; J2 G
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
- X: h& @! z6 L- F& D* {6 T<%
- `. e3 ]" [' T! S0 ]: N}9 t8 m: V: p) F: q
%>
) {$ t# t8 d, c$ ]! p </select> U9 |3 a; }- O- F' m
</td>, @/ g2 S% K% X
<td>
' z3 t% g( J2 y; _2 Z <select multiple id=city style="width:150;height:200" class="bgc">
$ k. g& d% V4 F5 b3 g3 [7 M/ ~ </select>& y. D5 ~* q2 D, @, \! R. w
</td>
7 H2 T. d$ q) Q9 ^0 g* W <td nowrap align="center" class="bgc">6 F* P9 B% P7 A
<input type="button" value="<<" class="buttons">
( Y9 k$ Z7 e( b( j <input type="button" value=">>" class="buttons">
{4 z" L2 w" f; a4 ]</td>5 v0 M; L2 D) q, D. j
<td>
2 {$ R& U# Z3 S# e <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
% @# o/ y2 y, f3 Y! [) T </select>7 E) s0 K9 a4 e' _- x8 x" M
</td>. b4 k1 n: Y4 g
</tr>+ x% x# m8 q8 K
<tr class="bgc"> * Y- |4 f$ G/ L. N3 o* z4 p+ c
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>4 [5 E; L% \5 F' d T
</tr>8 g/ J x6 r5 K! K# G
</table>: b: w+ v% h8 C
</form>
* q3 {# H+ _$ y# G3 F<script language="javascript">$ B# o. O$ G' a- }$ l3 T
//人名移动3 A" n0 U3 J, X6 h; ~# y7 p- R
function move(fbox, tbox) {! R; { h" o. ^
var arrfbox = new array();
2 E# a8 O# p& s0 E @# j6 @$ X: Cvar arrtbox = new array();; E: C1 W- M4 {3 G& B. N3 B
var arrlookup = new array();
0 y* E! r, A. N9 Qvar i;& Q- G, E# u/ M! o
for (i = 0; i < tbox.options.length; i++) {9 `( n+ V+ L+ d( [' W8 R: l( O4 Z
arrlookup[tbox.options.text] = tbox.options.value;) L- I# e" e* H- O, [! T- \# a- F
arrtbox = tbox.options.text;
, O) K$ @) z/ W7 A# [* a$ Z* K! {}
; L5 Y9 X* o: lvar flength = 0;$ |% z, A8 J- g( H% P; [* y! O
var tlength = arrtbox.length;: m; x: w( _; Y* _1 Z
for(i = 0; i < fbox.options.length; i++) {
' w% m0 f8 d8 v# ^4 f darrlookup[fbox.options.text] = fbox.options.value;
, Z1 T4 k6 Q9 Nif (fbox.options.selected && fbox.options.value != "") {/ z: \: o9 z( _" h) |. f
arrtbox[tlength] = fbox.options.text;
6 y* W5 L4 f7 d3 u `tlength++;
& y0 x; x, m# W p( f}& w9 \& ?( g7 l, x* P
else {* _9 b: y e, \3 A# k; q: g; C
arrfbox[flength] = fbox.options.text;% Z5 e- {, P0 V/ B, J
flength++;
2 P. v) [- V& Q }+ ~ g- V o* Q' k4 B) L4 O* I
}
- M6 q# ~+ x1 e! A1 M, K- varrfbox.sort();8 q! e P, S8 b& v; r
arrtbox.sort();. m* o1 e3 h( p4 w# r! t
* s7 p1 o: g% L& X
fbox.length = 0;; E- Q4 g* K! \" r" x
tbox.length = 0;
( N" T$ P# t* z7 Avar c;
* B$ g$ S' |" q! H5 A3 [for(c = 0; c < arrfbox.length; c++) {
0 B' _+ d" U. A/ `var no = new option();& H6 Z, ~& A$ y; ^% x7 [8 j3 }# p
no.value = arrlookup[arrfbox[c]];
( I. ?" o% [3 P0 Sno.text = arrfbox[c];
5 m+ F. c- Z g2 d0 V) e. N; M* v; Ufbox[c] = no;* D; y& H+ V! V4 O3 m
}
/ k0 c% q! H( ^. i% Mfor(c = 0; c < arrtbox.length; c++) {
8 H: _% n: T9 Z6 d8 f% k' fvar no = new option();
$ f- k6 v/ X4 f, c- Y3 n6 V' u0 Lno.value = arrlookup[arrtbox[c]];
; S7 j( g5 } G8 ]' \5 U4 \1 X1 cno.text = arrtbox[c];% X6 l6 C$ a. X# B5 Z
tbox[c] = no;
; w6 |# Y- Z9 s9 p7 S$ u8 [$ V }
; e9 v5 ~: h. r- V' P}1 }" @/ B, r9 v+ R, m, L7 z, {( [4 Y
</script>$ {6 Z' V# v/ ~$ C, c( p4 M* j
</body>
* d0 V+ }; h0 z |
|