|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14321
- 金币
- 2446
- 威望
- 1647
- 贡献
- 1394
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
' [* W3 ?5 Q- W6 s: E0 i5 d c pageencoding="gb2312"
+ u$ I. K: x/ P%>9 t9 k2 t7 y' W8 S$ Y
<style>
8 _0 P% x. t) @ c8 c- r.f9{ font-size:9pt; }" F7 G1 C6 C' H; f$ N( o& j6 V) C/ Y
.bgc{ background-color:#aecaf9; color: #0033ff }
2 I& n" C o n3 O# A6 A9 n.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;0 Y/ K5 o) n4 D
border-bottom: solid 1px #4e7dc1;8 N9 h# L# f5 q; U4 [" ]6 w
border-left: solid 1px #aecaf9;7 f& p+ Y4 k P& X3 v. s
border-right: solid 1px #5679bd;6 m/ M7 [6 v, _9 r5 o% R
padding:1px;
: k: v+ c" T+ }* q- g7 g' e margin:0px;}
8 }( H* N$ N; D3 t" w/ i</style>
; e+ P/ q5 ~# F/ F2 r<script language="javascript">
' O4 u% u& H& [, G+ T<!--
9 I( j/ ~% c& S: I1 N" l+ B) Xfunction rv()
- S8 y, N0 V. d! e" Y F7 y{
) s, B) r) e6 T' D: C" Y var val="";
1 O% I/ v+ f- N, `+ A$ X$ a for(i=0;i<combo_box.list2.length;i++){9 @6 S. i" S% R6 H: o9 `+ R
val+=","+combo_box.list2.value;
3 J$ R- j/ s1 A$ P: V }
b; O' W( B/ Z/ x if(val.charat(0)==","){
6 t6 ?& O$ Z# c& Y val=val.substr(1,val.length);8 t/ w% e: C" h u. P5 Q
}
1 X' D% e$ h4 Y2 \ opener.form1.frecname.value=val;
( z, [. S( \1 M) B" g self.close();
* W- C1 C- U. [9 ?4 ?- Z}
0 o1 K) I( |+ F: ~& m//-->! U2 {2 p- T; I! V0 Q1 k
</script>& G8 k/ Y1 E4 j) q7 e- H& |
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">/ G# s2 @$ F& |0 [) m# G) G
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />' }" u# n3 [# z1 C+ T
<%
7 G1 O! G; u! N! {' D( V( o cdatasource ds=new cdatasource(); //数据联结bean实例/ f$ k- W9 d2 j1 Q: s
java.sql.connection conn=ds.getconnection();
! Q1 f$ f' _9 `/ r9 D& D java.sql.statement stmt=null;, }8 g; h' A2 T7 i) Q
java.sql.resultset rs=null;* r3 d! `% X# H6 K3 W
cdatacheck dc=new cdatacheck();& k! a S9 k% I5 ]3 ~' T
%>
+ G# l) V* [3 `, T* R" v<%
, X2 A2 @7 T7 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";
$ U# p) G% ?: L1 g7 J. T+ Zstmt=conn.createstatement();( s8 ]7 ]$ A' H7 c2 Q
rs=stmt.executequery(sqlu);
( f# c8 G+ ^& J6 ^2 O/ I9 E%>
9 b1 t6 V' G$ {4 r" q/ c* P<script language='javascript'>& {! K3 |' ]8 w& ~
arr = new array();
: L6 t+ o$ e+ [3 D5 E1 c0 s<% int temp=0;
% I( v6 A; w) g: Zwhile(rs.next())
* @) Z+ i9 f# C6 r{
% \5 ^, C1 Q6 A4 q) V; e( W%>
0 s0 C. C5 J5 p' _, Marr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");: ?6 d5 u0 B" i9 G1 @$ V) J! \% s" e. ]
<%6 N; w; [- E/ b1 O% @
temp = temp + 1;
$ s: [8 e0 n9 ~) h9 [}+ j f( Y4 T U b, C4 D
%>
; N! k. P Y. X+ w+ Etemp=<%=temp%>;
' @) d$ G; I R/ S. o' Efunction changelocation(id){
1 B# O4 w+ h& Edocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
8 E2 t/ q, M1 ~) Y" w, Q* b7 Svar i = 0; z6 J, u$ J8 j, q" U
document.combo_box.city.options[0]=new option('-------',''); 8 }' d$ Q7 \# w/ u3 F
for(i=0;i<temp;i++){
) y$ T7 r. ~7 }' hif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] 6 h r/ c0 ] z! ]; K* G4 k
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); 4 h2 l7 r) w4 [# [, u( W0 o
} - |& j- e; N; N, a
} 4 A. y) I8 V; w* K; X" w
} ' G- J+ {* {; l5 ]
</script>
7 a9 W) r2 N% F- d, T4 Z
& e4 D$ l# A7 C( T' S% X8 ^<form name="combo_box">
$ z3 e b0 H) k, T. V. i$ t<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">2 s. d- C2 q8 [: v& c. j
<tr height="24">5 M! W" f+ j- a" O/ c4 @
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>2 e9 Q; X @4 P& Z) |
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>. ]6 {. _5 B6 L$ n, ]
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>2 I- }$ S; X( F) i! x( f7 W
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
# S; Z( }7 d. O+ }0 Q& n </tr>
& G7 [9 P8 \' j) l# w: {- |" B <tr> 5 C ~, i$ w! M/ {
<td>
* Q$ v. J9 o' O9 k& M <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">: ~; w1 |: a/ n( c0 D
<option value="0">请选择部门 ---></option>
3 y1 N0 `9 G$ y- O' a- |<%
& H8 u# q: }' D/ C string sqld="select * from tdept";- `/ O2 M$ J4 W6 T$ Y5 c
stmt=conn.createstatement();+ C6 g$ V9 x5 q2 _
rs=stmt.executequery(sqld);8 m J& _5 I, W' E
while(rs.next())4 {0 f. d: r. k8 j9 o# h$ q$ w2 p
{
' g9 q( V* ?1 ?& t$ C/ S9 ^- M%>
4 I3 }6 O! ]9 H& T. h: T7 E9 D <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>& U G9 d0 `& q
<%4 S6 t" Z% [! S9 z- T6 Z! L" A
}
/ i) l5 N2 [2 @( Y' | u Z%> 1 T' @+ W# }1 O& B% V7 r9 `2 \
</select># M1 C% f' ]+ `5 a6 F# J
</td>' X; y( i; e! j
<td>
/ T( _+ o. h9 m* a <select multiple id=city style="width:150;height:200" class="bgc">
/ ^! D7 i! G; k. G </select>2 \4 k# `# B S5 T# Q# ^
</td>
- `8 ^7 z& a7 K; L) v <td nowrap align="center" class="bgc">
9 f, i4 Z. j1 ^7 G, H0 Y8 W <input type="button" value="<<" class="buttons">/ r' O* a6 i) Z6 t6 C% K1 x
<input type="button" value=">>" class="buttons">. i' i" A$ y" e7 Z' y; E
</td>. F6 i/ j# j( H2 K& @+ E, Z
<td>) \8 b+ H" Y H* A5 A3 k# e
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
~2 `% x* v) y9 h# z/ o </select>
5 ]) R [! W& _. v, s+ G</td>" S) A' k8 d8 a: x1 U+ R, J
</tr>: I3 P! u: f4 t4 R4 ]
<tr class="bgc"> / {- Z5 ]% [$ ^8 b
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>. ]8 I1 P$ i# U$ Y" l! Z" ?+ Q
</tr>
5 C: p9 f+ e& n! ]" _& d</table>
- y4 a) ^9 f; ~6 M' p) @</form>! s, k) Z. u3 D% R( ~8 O/ E
<script language="javascript">
$ s5 W+ {* Y/ o( m, Y//人名移动
6 p" a4 q' Y4 Y+ ifunction move(fbox, tbox) {! A1 O% L9 V# {, r, ~7 J2 I7 {
var arrfbox = new array();
. t9 c5 ^! l; v# @( K( J3 Cvar arrtbox = new array();- M! Y" V" g o5 ?9 _
var arrlookup = new array();* D' `1 B) r% r
var i;. Y. U3 q, I! c2 \- `
for (i = 0; i < tbox.options.length; i++) {
7 U) r" n" I- ]/ w1 _8 Carrlookup[tbox.options.text] = tbox.options.value;
9 i6 a' R- {8 rarrtbox = tbox.options.text;
: L1 N2 L3 k' q5 k6 Z; L}
) K% r3 T7 `7 r6 J: vvar flength = 0;
2 O' _2 O8 k8 h5 Nvar tlength = arrtbox.length;
. j4 X5 {) F0 r: u* w. V9 I. Sfor(i = 0; i < fbox.options.length; i++) {
; y9 @; |. b0 Aarrlookup[fbox.options.text] = fbox.options.value;5 |2 a) c% u2 k+ Z
if (fbox.options.selected && fbox.options.value != "") {: ?! a% P' L( d
arrtbox[tlength] = fbox.options.text;3 Q; }8 r3 z- {; v/ D. M2 \& `8 s
tlength++;/ M1 Y$ W; z; A5 k7 B
}
0 Q- s$ U7 ?" L$ B X! n: \else {
' T/ I$ L& A1 @$ R/ iarrfbox[flength] = fbox.options.text;7 T% M& o, o L* W1 _
flength++;( c. F' `0 C) E
}
3 g7 [" |- S8 ]: X1 I% C0 M}
7 S, M C5 v% y- v- G; o8 xarrfbox.sort();
- K3 Y) v3 C) e5 l) Harrtbox.sort();
+ l2 c! \( ~) C, k' n. f* X. {3 D+ v6 f. m J5 R2 ]$ C
fbox.length = 0;
L9 o( L- p9 h6 n* N% d# Etbox.length = 0;7 T) ]9 T% l' d. ~% c
var c;
- Y1 X+ l2 b) ?7 ^& k6 W2 ofor(c = 0; c < arrfbox.length; c++) {$ X1 X, i( d" K& c G
var no = new option();
8 N* [7 p- Z* l3 \2 B# Sno.value = arrlookup[arrfbox[c]];
* d$ v5 f, \. W& gno.text = arrfbox[c];
- w9 v8 a0 o E3 B2 Dfbox[c] = no;! i5 x+ U) \; T: j$ L4 F
}; N$ \/ O) Q& D7 S5 L/ ~( Z
for(c = 0; c < arrtbox.length; c++) {' z8 Y2 T- E- k8 F3 d
var no = new option();
9 i% w! E. D' D: t; {no.value = arrlookup[arrtbox[c]];* W" L( x8 ^- g
no.text = arrtbox[c];; M2 m9 \# [- Z4 n
tbox[c] = no;0 `/ I' `/ g! a% t
}
! _& |6 X. Z9 \# T4 Y) `' F}
0 p: K: v) ~* E4 d( t. ]8 T</script>8 N" M& _. O1 U9 Y; E5 @6 t8 T
</body>
: P1 }* O! m: c: s |
|