|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14413
- 金币
- 2492
- 威望
- 1647
- 贡献
- 1440
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"8 Q1 s+ Z( C7 O$ h, G
c pageencoding="gb2312"
% p$ k& D2 i# P- F. P%>
n) \( X! `2 d5 x& [3 B2 N9 k<style>
' C% a* J( s3 [& K. A; i.f9{ font-size:9pt; }2 c2 p2 b' ~/ f1 G9 [
.bgc{ background-color:#aecaf9; color: #0033ff }9 n, w" X: s( } F7 n4 ~
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
& l8 d$ F3 T, s H; C; } border-bottom: solid 1px #4e7dc1;6 O" o" `1 z/ ~
border-left: solid 1px #aecaf9;, L" q$ O1 }; j4 b
border-right: solid 1px #5679bd;7 c! o4 Y8 g2 d1 C
padding:1px;& X9 z8 i5 x% i" a: Z# `% k
margin:0px;}1 D' R) [ o( L; B: |0 ?6 y
</style>4 }5 ?# m7 g p0 d. ]
<script language="javascript">: G+ a* l- ^8 g* G
<!--2 A$ B9 d" T, i# e+ s
function rv()7 A P+ F- o* p" A/ t" m* o
{
: E' {$ ^" @- y; a- E var val="";9 q0 w: F' d6 x& t x8 k4 N
for(i=0;i<combo_box.list2.length;i++){, P7 R0 a o4 g& H5 ]2 A' e
val+=","+combo_box.list2.value;, \# o, J) O$ M) |- Y
}
; C' }1 m& f9 [" {' Q3 i if(val.charat(0)==","){1 }3 ]% ~0 ~/ l; b4 }
val=val.substr(1,val.length);2 U2 f8 C7 K) G* C7 R. {) ^
}
G7 i" y. c+ E/ M" w; T6 \ opener.form1.frecname.value=val;! h2 s4 D6 c9 k& }6 c
self.close();
. e# S' A% a8 M0 d}9 f M' c2 l$ ?( r( p A
//-->
: j- d( l9 o4 l4 w4 E# T. e+ w</script>4 q* \1 w; B( _: N
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
1 G; O/ u' I# x" M6 L<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
) B/ `& H8 C2 h8 Z5 O" }2 ~<%) X( J" Q. f8 p- L9 c( J
cdatasource ds=new cdatasource(); //数据联结bean实例# k- F& B* y( c6 V, _9 J c
java.sql.connection conn=ds.getconnection();
. b C. i" I3 ` java.sql.statement stmt=null;
& X9 u8 Y, ]+ J4 f0 w, N8 O java.sql.resultset rs=null;
1 d- s) D9 z6 h0 S0 r' Q0 O cdatacheck dc=new cdatacheck();% L; N- f/ @' q- G8 z6 r' T8 T. V
%>
: a3 }6 g' h0 |1 r<%
& C) K" T7 i% Y- K( A8 h& Bstring 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";: F5 N2 m) z: z& Z5 Q" G* s
stmt=conn.createstatement();+ V2 y5 A, `! R
rs=stmt.executequery(sqlu);9 f9 c, T- n/ A7 g# f
%>( ]! Z0 I; [& y% a4 [
<script language='javascript'>2 K& l, P0 `& I
arr = new array();
$ l1 V7 C: i; b" f<% int temp=0;& v3 v t' \4 T
while(rs.next())/ [) b0 ~3 ~# I) U2 c# E
{
4 j; F& e( r2 i5 Z( o5 u' y5 Y%>: Y4 W3 S* ~4 o+ i, | F' l4 c# i8 o
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
4 Y. v m* o e& e ^: y; r4 [<%% t; I) w7 ^. e2 {
temp = temp + 1;9 p3 w7 T4 v, c2 |! r
}+ ~5 l4 U# U3 d' Z7 b
%>% C7 ^- B& ]2 t* y) y F' j
temp=<%=temp%>;. n j% Z3 o$ P: V( p
function changelocation(id){
! B3 k; \3 j' ?document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 4 I# T% E; x+ ]: B$ d0 v" {: q0 q
var i = 0; 3 a/ h$ F( z' o0 ?2 K1 ?$ U
document.combo_box.city.options[0]=new option('-------',''); & E4 `* p! |/ W
for(i=0;i<temp;i++){ 5 G7 Z2 s% F7 G9 T8 w, H
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
( x2 u: S! O4 jdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); ' U7 P/ f8 V. f; h+ j7 Q# V
} 4 D, X+ E+ W U1 J; o/ C0 N
}
4 V! Q3 B |) U! A" k} * |: z }0 J9 L7 v2 [9 {" Q3 e
</script>* H z* B2 u# u, r) v
8 W8 o6 }0 d. n, O3 w7 j4 K<form name="combo_box">' w9 v" B# ~; K
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">2 H- t4 R2 g+ ?$ U
<tr height="24">
9 ~; l$ @( y% e! Z7 y5 i$ \ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
2 O& s9 F/ B! R4 N6 _) f) S, A; v: n <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>2 X* Z9 S* P7 }4 O
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>/ }5 m6 e3 y/ W
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
. R, z6 X% L1 K) R% y: F7 H' ` </tr>
& z0 Y4 f4 V& a0 _& W <tr> 4 _4 i0 _. o* H3 F
<td>
! Z" u4 |' ?5 u. M) n <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
/ B- S, r+ w' R9 V+ Z+ F <option value="0">请选择部门 ---></option>
: C+ \! R9 l9 R3 z. J0 S5 z<%' V$ b6 `/ y! }. r5 c
string sqld="select * from tdept";
( a' _+ p7 O% h9 P7 k: M0 Qstmt=conn.createstatement();5 B! r0 ]% e/ @6 d# n9 n2 C0 d. ?6 D
rs=stmt.executequery(sqld);
8 u$ C. H" g$ U& _# cwhile(rs.next())
2 h4 b F; V6 {{% m6 I) o, V" j$ s$ t: W8 Q
%>
* v8 F5 n* c2 M <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
, r9 q4 B/ A. p2 L2 q' |<%0 q4 t4 O% V. D* |) i6 g
}
: A# ^6 K( P/ S8 P$ f%> 0 o; g9 @, U5 a
</select>
! o" R; E4 P/ C" C& E; _9 p</td>% `; ^" E6 k0 ~: a" R7 P% T
<td>
$ L* ~3 L. P0 @( k2 x/ f7 k9 r5 B% _ <select multiple id=city style="width:150;height:200" class="bgc">: z, d0 M* L* K1 ~+ H
</select>! H; f7 y4 v# D0 z# L0 E
</td>' X' B, z. ^3 f \- y: Z2 Y
<td nowrap align="center" class="bgc">: U* j9 E0 r3 Q6 r: a+ p
<input type="button" value="<<" class="buttons">! c, `; x$ P* l6 O& c' k/ Y7 }
<input type="button" value=">>" class="buttons">
! g! a- B- I5 E8 G! k</td>
9 u1 E& N, Q' U: X% ? <td>, I4 [/ w6 L" ^) \, Z8 s, }8 _
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
2 `. H( i+ M$ E/ @% t3 ^ </select>
, }; `3 c _8 ` i</td>
# Y4 {1 w* x3 M; p7 i0 t </tr>
: d* ]" B- k; c1 Y/ J( i <tr class="bgc"> * \3 C0 v, U/ P
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
% P `/ E: ^9 A$ n5 Y2 Y </tr>
3 `1 m1 W- q0 w0 D0 m</table>4 K6 t3 l: t& X# i1 ?
</form>
3 w6 V C3 m0 m<script language="javascript">
) `/ `9 O) O" Q//人名移动9 e' }$ P" U0 z k
function move(fbox, tbox) {* e. c2 m5 O5 ]. r" M1 t G
var arrfbox = new array();' I0 F8 k$ R, Z/ Z* `( k3 \. D+ t
var arrtbox = new array();
8 | i. d( L! r1 Y" o* Q5 evar arrlookup = new array();( O$ Q. I1 e# r" v* ~8 {* V4 u' u/ O
var i;
6 D+ d3 A3 G4 v9 Rfor (i = 0; i < tbox.options.length; i++) {
: ?6 s5 e$ w8 l* Q; o% F$ Narrlookup[tbox.options.text] = tbox.options.value;
}- I7 P1 u8 I# q# u) G# karrtbox = tbox.options.text;
+ C/ \, E* E4 a' v h1 U}
: Q/ L: X- Q8 |6 ~5 Q6 jvar flength = 0;' j1 l, ~9 X" r8 |
var tlength = arrtbox.length;7 q" R2 B% O6 E% x6 K4 ^/ ]
for(i = 0; i < fbox.options.length; i++) {& ]. g- b$ e2 C
arrlookup[fbox.options.text] = fbox.options.value;7 O- W5 A7 Q& ~8 O3 C
if (fbox.options.selected && fbox.options.value != "") {6 P5 L) ~1 l0 M$ _* Y( T
arrtbox[tlength] = fbox.options.text;
: P( \ G, ?5 r# b* C0 N0 G+ Btlength++;1 j3 {( h _6 L+ Y* a3 w7 i
}) M1 M6 }/ d5 C) `# f3 y5 v8 v
else {5 \+ A! l6 W. x& O: x
arrfbox[flength] = fbox.options.text;
; H* y; A& |! e) C! F& Nflength++;
0 @/ h9 ]2 o8 L' S3 P- l }
8 v( u; t; C( [# d1 e8 x}
- |1 w& l* O+ y. Q. barrfbox.sort();
( y$ j# i/ M* farrtbox.sort();
0 S O9 s# _, x4 Q/ q1 e1 ]: h, ?, H+ [( s8 {# |
fbox.length = 0;
* o% z+ [1 {6 y8 ^- Q9 ytbox.length = 0;$ _9 z/ s: U8 I @4 n
var c;
# H j1 s+ z" b; J; z& ^- [& ]for(c = 0; c < arrfbox.length; c++) {
7 h9 D9 c0 I/ Q& Y" V9 |var no = new option(); t+ c3 s1 D6 u4 a4 I6 {7 I
no.value = arrlookup[arrfbox[c]];
& C1 U& y* q- j8 ?- _no.text = arrfbox[c];
& c4 Y* O- X) i' C5 yfbox[c] = no;, j/ q7 ?. z, W+ w0 }+ q
}
/ @4 w8 d0 }/ A: F# \3 m6 wfor(c = 0; c < arrtbox.length; c++) {1 ~1 u0 i B, g4 i; h
var no = new option();
/ E/ @+ x2 u# l( |& w" hno.value = arrlookup[arrtbox[c]];
0 e( n N- q7 o. kno.text = arrtbox[c];
! z9 \, I s8 m+ Qtbox[c] = no;3 {6 u; ^2 H( b: g- Z
}
3 z% O' k3 ~( ]- b}3 {3 ?! |; I- H' R/ a6 _
</script>1 y# n, B4 G+ @3 Y- t6 k
</body>
U$ }' F( S& n! i- m |
|