  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14247
- 金币
- 2414
- 威望
- 1647
- 贡献
- 1362
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"7 r3 d( \) F3 f+ g
c pageencoding="gb2312"
- { [6 B+ c& Z6 {%>
1 i. ]! `( v) M5 M [<style> v& R/ s9 r. b2 w) h Q" u
.f9{ font-size:9pt; }
6 \. l1 f) W: Q0 F: D: q5 N0 ^.bgc{ background-color:#aecaf9; color: #0033ff }
" W6 V/ M0 A$ x. C2 W P.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
8 Q4 H: D# E' v' K border-bottom: solid 1px #4e7dc1;
1 R' Z$ i: _' S/ i a border-left: solid 1px #aecaf9;- ?1 w9 W$ j: M& D
border-right: solid 1px #5679bd;3 J% t8 Z% {" Y9 X% {0 j
padding:1px;/ w" \) ^0 H1 a* J
margin:0px;}7 A1 y& B" B4 |( x' T) \6 `- D
</style>
0 X; s8 L: w. O l; a: K<script language="javascript">2 j ?$ Z) J' g/ u& o' K, r
<!--. K5 s8 c3 q9 @) z8 J5 v
function rv()* Q3 N: {3 b9 ?% r4 T
{
! D" l5 j2 q! }1 g1 Y3 F8 K var val="";9 u+ K6 u, D4 M7 t/ B
for(i=0;i<combo_box.list2.length;i++){5 z0 F, F v# e) {2 h& {2 s& I9 \
val+=","+combo_box.list2.value;
! K; C9 R7 A! P/ m }
& I; R3 B; }& \& e- ~ if(val.charat(0)==","){
! U( v5 \' [( o# n9 [ val=val.substr(1,val.length);
; |4 f/ X/ K" p' y+ O+ q. c2 v. m }. r- k: f t, M% u
opener.form1.frecname.value=val;, s9 o8 H; E) k5 N) d, _
self.close();
" o% r2 _: S" M}
) J3 ?5 A. n/ g F//-->
# ?! n& ]- E( m! w3 e7 g% y</script>
4 f, q- Q/ N2 B% {. ~. [* }<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">0 ~. {" {1 J9 |9 p, {/ x
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />4 b9 w2 N0 C, v% f
<%+ D5 W L9 B% h3 S1 r1 Y
cdatasource ds=new cdatasource(); //数据联结bean实例 z2 h6 T* ?" L# L' Z' t
java.sql.connection conn=ds.getconnection();/ b" S6 Z3 D+ s6 L1 T
java.sql.statement stmt=null;# A- w9 E& R$ D+ L/ k4 x) ^
java.sql.resultset rs=null;. l2 Y0 L8 g( k! G( J/ d
cdatacheck dc=new cdatacheck();
; {& y* s G% }! ^! F6 j* {& t: ?/ p: n%>0 F' T1 ?& t) Q+ u' E
<%# q8 D/ |2 [+ z$ C3 [. h
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";) d3 _% U9 }# }/ I: b$ i! j; d
stmt=conn.createstatement();
) p) E7 |0 c4 {- k; n3 Z r5 f/ wrs=stmt.executequery(sqlu);
5 G6 U- w* u) R) J) q6 |7 D%>. f: w ^1 I7 `+ v8 A( \9 l8 u/ b
<script language='javascript'>& R. z h1 q1 I/ p6 S
arr = new array();
* s+ y. q/ }4 Y. [1 o<% int temp=0;
# Y& p4 n# V% ~1 a2 C4 O- N$ bwhile(rs.next())) |3 n2 S5 X8 M$ h
{0 t0 X0 I6 C9 J& K+ Q3 y3 h
%>& T7 c8 J# k5 V) Q+ A. H. E0 W
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");, f" `; g. P; V* n" b) v
<%6 i7 C0 Z3 O, ~% z+ J# l
temp = temp + 1;
( k# ?* A8 |, U H0 u}
" w6 w- L% n5 N* w' k5 s" y3 O%>
8 @6 K) A: F: Ytemp=<%=temp%>;
" i" b, {* c' E9 H2 Efunction changelocation(id){
+ Q$ e9 R/ }' u( m% _9 z" Udocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 1 l' {4 `9 D6 G
var i = 0; . _ ]2 d- Q, `! K& h" t0 j1 }
document.combo_box.city.options[0]=new option('-------',''); ' _3 w% ^0 o% t; Z" ^: K, i) H
for(i=0;i<temp;i++){ ' p! l2 T# c; K# }7 S N
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] # D' D5 C5 L9 U& r% t' Q
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); - `6 H& G- X) |$ K* a) f
}
/ A; r; o: R# d0 p! ]}
* F* H9 e- T* \$ z8 I3 g}
- g0 K( l8 `5 @' |</script>( z+ }+ s% x* n
' f+ P# y# {! r1 t7 K4 q; z: I<form name="combo_box">
/ S3 [0 _* e* u$ G% n, T0 d v<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">% \. w0 @" X6 b, r, P5 q" |8 }
<tr height="24">+ q* I+ l+ d' A$ E7 H' {3 c, F2 n* n
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
. i" z: j9 y$ B: P% Q& X <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
0 F3 q# X$ ~) c0 C <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
% ?6 \! @! q L! x/ ` <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>: k# @* ^& f* l3 Z5 n
</tr>' k# R. T* l7 b% a w
<tr>
! Y3 u1 \- @ n# }! E <td>6 N; I+ a1 r( p1 V) Q# A U
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
/ A. x6 |2 b% @: i <option value="0">请选择部门 ---></option>, ]2 r% [; D% b0 x
<%/ @3 d2 R2 B' V8 W
string sqld="select * from tdept";% g0 h. U9 R- c E. ~4 D
stmt=conn.createstatement();
# q% @: W1 G, S+ x5 h; \& d! grs=stmt.executequery(sqld);+ ~- w8 E- i1 [: O
while(rs.next())
i" l1 \9 ^4 }3 v{5 ?' ]7 W/ K7 z" M
%>
1 }' s% F4 k# p/ a- ]' W, P4 C <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>: L( ?# N5 m/ F/ W; Q
<%
; |7 y# m6 E* v: }. N' `3 n}
" c& [) q6 H: h) ~%>
7 S/ T. K( [5 c8 _ </select>6 Q' f1 J6 k6 L: G4 A1 V
</td>
8 G- R3 z5 r4 O5 n- X0 [ <td>. |5 c0 |$ S7 c/ z) ^3 v2 E5 J
<select multiple id=city style="width:150;height:200" class="bgc">
. B, X. ?' a6 w L/ o </select>+ X% p' t1 t7 O3 X2 \
</td>
( c# n" D$ y, {- r: p* y$ ~8 j: E5 h% A <td nowrap align="center" class="bgc">
/ s" B% `" O1 p <input type="button" value="<<" class="buttons">- c. \) s) i: U4 C Z' T" b! S
<input type="button" value=">>" class="buttons">
/ g' X! F2 E. P! F" C0 S( |</td>2 E3 J# |; V* J) K7 g5 f
<td>: a5 U# m2 H6 I: \) M" j$ s/ O
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">8 I7 @% Q+ z: g4 G0 \
</select>3 C2 d5 P; ^0 t5 q. l$ x
</td>' X! Z( m% x0 F( y2 L$ i3 Y
</tr>+ A9 P* ~, F2 c8 l7 f4 |
<tr class="bgc"> + T9 _4 }: |2 a% z R4 S
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
5 C' t* ]3 ~) P& p </tr>9 R+ S$ N0 s7 r6 X- W K
</table>9 ^! \/ g" b7 k8 o& E! y
</form>) s# F2 B* F: z) _9 M: o: Y! K
<script language="javascript">, O" w. ], m; r7 ^% }4 d+ f
//人名移动
; o9 C) T& c, k$ `function move(fbox, tbox) {' Z# R; a9 M F4 P- Q- ]
var arrfbox = new array();" j1 I( a9 R O& f
var arrtbox = new array();7 @8 M+ b0 j/ ^
var arrlookup = new array();$ V5 y: a+ m% l* k/ K
var i;; T6 q% J( c: j9 X, M& m
for (i = 0; i < tbox.options.length; i++) {
, ]' F' c6 X5 B! y& ~ X. E- Tarrlookup[tbox.options.text] = tbox.options.value;
9 b! V2 I" P8 }( ?arrtbox = tbox.options.text;
1 n* G- I% W0 Q" K, c1 s ?% S& j} Q# v2 j* }# K) L
var flength = 0;
7 A6 |$ b, p# C8 d' Qvar tlength = arrtbox.length;8 `, o l) m7 q: ]7 W0 T
for(i = 0; i < fbox.options.length; i++) {
7 x! O1 n5 x$ e5 v) t8 d0 Earrlookup[fbox.options.text] = fbox.options.value;
: Q& M# {" q- s# ]( jif (fbox.options.selected && fbox.options.value != "") {7 I6 b/ n; l: R: s) A/ n, R
arrtbox[tlength] = fbox.options.text;' P7 L8 _, Y8 z
tlength++;- b" V6 o% |6 A6 J' m" K
}
u' a& i& F3 K! _+ ?else {7 o7 S* _2 D% [, l* M
arrfbox[flength] = fbox.options.text;
. G* }" n( F; G) ] h$ M) k+ vflength++;
, N2 [. p; r2 k( g: P8 b6 \/ ?0 q }; E5 N% S" {3 h0 T0 t6 A5 G6 T5 x
}" i2 Z9 L& t: N; _: W- s
arrfbox.sort();
" m+ P/ i# l i, q l4 sarrtbox.sort();
0 `; T ^- g: p' d
- B5 B+ k2 T n; nfbox.length = 0;
2 L# ?$ D! ]% Ztbox.length = 0;
f$ o1 N9 e- ^var c;
6 o9 [3 T# }, N0 K( Gfor(c = 0; c < arrfbox.length; c++) {( a' Y4 _( v2 J6 V/ |- W0 |8 e
var no = new option();( q/ a8 j$ ]7 a- }4 K* H# O
no.value = arrlookup[arrfbox[c]];& S3 \1 j% T9 _/ C5 }
no.text = arrfbox[c];9 n3 j8 m( f8 z! y# }* m' b1 U8 J" y
fbox[c] = no;
+ L6 X, B3 i0 C( N& U}: a* i3 W, p) n5 Y
for(c = 0; c < arrtbox.length; c++) {
1 ?8 `5 R: B5 s3 t+ Kvar no = new option();
' ]$ Z8 d2 C: Y9 `4 i* B! I; vno.value = arrlookup[arrtbox[c]];9 f/ M8 ]" z- A2 S1 C* U; s- h
no.text = arrtbox[c];
# W1 e- f0 B7 D2 b3 R9 R8 p9 ]$ Ktbox[c] = no;
1 ^% \- ^3 T4 X5 G) K& I: I }
8 t. S* R7 j4 P3 g0 H; H, E9 w/ j}" t9 s, f0 x1 q8 U1 y$ }% M
</script>$ A. M3 x( {; ?: }7 T& G" Y/ ~
</body>8 X z* L* B# ?4 ~9 O% w# k" }
|
|