|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14377
- 金币
- 2474
- 威望
- 1647
- 贡献
- 1422
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
# ~0 _, M) x# F$ ] c pageencoding="gb2312"8 i1 @8 z! `. u0 y, F6 U u
%>( S0 |, c" f; Z
<style>5 z a( l2 S* t6 Z
.f9{ font-size:9pt; }
4 N4 {. q7 [! J1 ^1 _. w$ _7 [( R.bgc{ background-color:#aecaf9; color: #0033ff }1 Q0 d, i, ?8 K) w, `, P
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
" P% v$ v1 ~0 [! z! k( e. @ border-bottom: solid 1px #4e7dc1;
& r: } s8 F- {" ]4 y4 b1 U. k3 n0 V border-left: solid 1px #aecaf9;+ i' [6 y- t3 r/ K6 O# }* F* F
border-right: solid 1px #5679bd;+ R1 N+ n, C$ C: M: _1 S
padding:1px;
2 U% j* j9 P7 I1 l margin:0px;}& @1 u8 r, F' F6 Z4 T! ]3 p4 V$ c
</style>0 C5 S/ n/ S3 w* i
<script language="javascript">- C9 ?& N6 D V4 [
<!--6 V0 l) N4 B+ w# M3 a; {* {
function rv()5 w/ ]0 b+ X& n u
{/ C# e& ?3 P# O+ [; ^* B
var val="";' G; G. |3 u( C4 U. F9 \. P
for(i=0;i<combo_box.list2.length;i++){
5 ~3 j0 }; C& O" z0 K8 W val+=","+combo_box.list2.value;
& _" l! j- T# b: k3 y7 v* S }' @. D' G; _ T" A
if(val.charat(0)==","){
; g, m3 k% T% y3 l; B. d val=val.substr(1,val.length); @& F5 v# W2 y7 V" M% {) Y$ a
}
3 {! Y+ U& N- f- {* Z1 c4 U opener.form1.frecname.value=val;& g& ^2 i( y, ?6 ]- H
self.close();! _9 A9 t( B2 _0 ~+ ~$ E% h+ G
}! z0 B9 K. ]! s, N \1 m$ @
//-->4 y P( e- M, F: u M
</script>" h! \5 Z- K* e( F* u& e" a P
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
2 l. K" \( c) B- Q8 ]. G<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
* x! }: l' S u8 p- h<%: O' `; `7 b/ L" s$ J
cdatasource ds=new cdatasource(); //数据联结bean实例$ P% u v! v" I7 \
java.sql.connection conn=ds.getconnection();) g0 H7 `: P1 J1 j* M7 v5 g: W
java.sql.statement stmt=null;
1 b5 L9 y8 H7 }! V& { java.sql.resultset rs=null;7 J8 j1 q* H; O3 Z" x; @
cdatacheck dc=new cdatacheck();
; V7 N4 f% j9 {%>
3 s2 {4 T0 ~1 `( H<%
' D* X: M# a4 {; `1 M+ ^! R) v* |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";
) v* U6 L$ P% z" u! z- f, estmt=conn.createstatement();
, W# t: n- T9 o0 w7 f; Trs=stmt.executequery(sqlu);
7 ^" o& c6 p. o%>
5 n/ l, }+ P* l5 S% N9 D+ I) ~<script language='javascript'>
& e' x* ~- D) M' i/ p/ karr = new array();
4 b+ K+ T, x5 x8 E5 U& l: ~<% int temp=0;
2 O8 Z- Q* t. T+ P, f4 h( j, u- ~while(rs.next())7 H. O& |' y; \. j& n
{, M& V2 L% p/ O& m# ~
%>5 ^0 [, I; M! }* b$ Z: b
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");; w* t6 \- V5 V, M
<%: y- ]3 D/ \. t& c7 Y
temp = temp + 1;
' w `/ D" [3 @! @% g' R3 c}; ]& G$ C ~3 s/ y1 x$ v+ d
%>
: D. a( Q8 B5 {/ f/ Z/ ^temp=<%=temp%>; Z8 k8 w( H( K$ O& m) [$ U
function changelocation(id){
0 N: T+ K0 [3 m# Z/ ^: ?0 v( Mdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
) A8 F8 v( I( l% j+ L0 p- s$ e4 e! Cvar i = 0; 0 T. e0 ]0 V* f' r E5 @; g
document.combo_box.city.options[0]=new option('-------','');
1 g* B W/ B3 E ~2 Q( ~4 \0 ufor(i=0;i<temp;i++){ 4 z4 P: [3 T3 }: @: U
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] % T' e3 q% k9 B- ^
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
: F# |6 ^8 r" s} / l! y, k2 U2 Z6 v9 ]
} & t- ]8 E' B/ K1 i( Z# U
} & p ~' j0 q* ~' q
</script>
! a c1 {, Y' @% Y7 ?! N: G$ k; D8 \) d/ l" r# U0 g6 d7 Q+ n
<form name="combo_box">
, E6 \' M& z2 C. v$ I9 {6 S<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">- R, R0 V' g% T2 ]9 H, h3 L8 m
<tr height="24">
& N9 s' q4 ?* l' w; ] <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>- F. w7 x8 ]) s: G
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>' x' Z: l& K1 U; O
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>) W2 t- q) P0 H3 \% R( n: Y
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>! l' x. y9 s0 H- Q) p; w! l8 p& L( [
</tr>" {. o5 m4 X: P+ i: s( v
<tr> / U# S; z+ ]9 o; Z" B, m2 D
<td>
/ S2 ]4 U' P" I <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
3 F# i0 g+ U* k <option value="0">请选择部门 ---></option>
: [5 q U' `- g; |+ Z, ^<%3 z6 D: V& {1 \1 W, @( e0 u6 f$ q
string sqld="select * from tdept";
) z. K/ [) y9 q3 }stmt=conn.createstatement();
# I- R/ ]. k3 O! S! o( grs=stmt.executequery(sqld);. u/ q1 T; q5 l1 N) B F7 s- P
while(rs.next())
) Z; @, Z: z/ @9 _4 u. o{; O1 X/ P' i7 ]6 I9 d* H
%>% [/ x- d' \0 M9 o7 W
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
) X/ X2 r! p# z' A% H$ P$ Q<%
) }: z: G4 k9 c% u0 D% P}
. Q( N) B$ J8 [3 C0 E. l6 y6 o%> 7 |4 K9 z* H2 r" D* r1 |
</select>; x! ]5 [& _6 @) C1 T0 K4 {3 A
</td>8 L3 O5 @4 k* e/ X' A0 B
<td>6 s8 J& O, m4 Y% P u. [5 c0 X! F
<select multiple id=city style="width:150;height:200" class="bgc">
Y. i, o- b6 q, H( B8 R </select>
& N' C2 ^: X3 h" U& B# {</td>
! S! j Q+ C( l6 {& L% c <td nowrap align="center" class="bgc">; d5 o! K5 e: G, ]+ t8 T
<input type="button" value="<<" class="buttons">
`* z$ J; L; V# p3 |8 N3 S# ^ <input type="button" value=">>" class="buttons">+ ^1 L6 j; [2 ?, |! N+ B5 \
</td>9 q t4 `6 M& t/ B! F6 y
<td>
I* {( \, N0 A$ w- \ O <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
1 y; R# Q( Q |$ G( ]% b </select># ?: Z6 W' E3 j+ x& F* o$ K
</td>
" [0 L3 k8 i p- s1 |. t </tr>6 W; j3 l; E9 T+ ]
<tr class="bgc">
+ _& G7 K- w" l$ z <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
4 a) K. ~6 x P: B+ T4 u </tr> n) ]8 w2 |% I1 _: N9 T
</table>
- u& F' S! c$ W9 y( k2 }3 O$ w</form>
$ }( U2 z. c: A5 y3 e' Q4 h<script language="javascript">
, O W3 z: y$ `1 K1 z3 H//人名移动+ @' A2 b8 {0 g( Z% X
function move(fbox, tbox) {
2 ?! a/ f/ l* a+ f8 svar arrfbox = new array();
( r: ]5 C0 ]3 y4 l; _var arrtbox = new array();( Y/ ], w9 e% u6 \3 U
var arrlookup = new array();
; F% |8 s4 t# R) \var i;
, ~, Z3 b/ w( c7 q! q. }1 jfor (i = 0; i < tbox.options.length; i++) {
, f6 T( j# A1 l" rarrlookup[tbox.options.text] = tbox.options.value;
# a' C9 o) K* ^$ i4 S1 Z1 c' z6 varrtbox = tbox.options.text;0 x. v- q W- q/ e* f& W* {! i
}( W4 G1 [8 c$ K
var flength = 0;/ p# J8 m$ o4 k; S+ h) d. V8 A
var tlength = arrtbox.length;
8 h8 @$ h" o! h h0 u- dfor(i = 0; i < fbox.options.length; i++) {6 b/ a4 z# y' f, R
arrlookup[fbox.options.text] = fbox.options.value;
$ Y+ e5 ]' X% b, \+ Y& Q; ?if (fbox.options.selected && fbox.options.value != "") {# X3 z. |. P8 F7 b1 g7 H' r# g
arrtbox[tlength] = fbox.options.text;
# F( ]8 p, } A" G+ E- mtlength++;
6 u: @( g. I; @/ x% y, P}
( K9 R& H" x* s: T: O* oelse {
3 F! {) Q/ G! oarrfbox[flength] = fbox.options.text;
6 x$ c- D3 f0 q4 a" Uflength++;" T, Z' @+ p. V6 ?% Q, s: d( }
}- a8 U" y( |. L$ R3 T: w% v d
}
7 e- A# p( d4 @5 Z. j; U* ]arrfbox.sort();& _9 _6 q: \: H* J
arrtbox.sort();
' F- _) w9 T5 P; J' e
) l- ]0 I/ k2 yfbox.length = 0;4 X8 Q4 }4 b* K, \. `
tbox.length = 0;. U% w, ]1 B. V+ g2 }6 z2 \% B8 D; p
var c;+ h3 b( s. v. T- \. u5 |+ M/ I! ?
for(c = 0; c < arrfbox.length; c++) {
4 g4 M* G) S& ^8 v) |& Uvar no = new option();
9 G2 _& G& g, {0 q2 Z; @+ ]/ Jno.value = arrlookup[arrfbox[c]];
) L* X6 B$ a8 x. dno.text = arrfbox[c];9 i/ F2 c# @3 K; {5 U6 z
fbox[c] = no;
% a( s- | x2 d k: Q9 \}3 V: N; l: P' b0 W5 A3 `
for(c = 0; c < arrtbox.length; c++) {) \) ^1 n, I* p4 d
var no = new option();9 o& { u# K3 d6 H) K
no.value = arrlookup[arrtbox[c]];. B8 `" \2 B4 V2 |! J2 Q
no.text = arrtbox[c];
1 C7 d4 Z! a: K! v8 W3 U/ j" [tbox[c] = no;
q& u C+ e% L9 _+ ^ }; G i* k5 ~# r- x( t. @* b
}
& F4 d" m; C: S2 j</script>5 Q% F* v% K. Y6 n9 V* e1 |5 \0 }1 `9 @
</body>% X3 b0 S$ Y; ^" P4 j8 V
|
|