  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14221
- 金币
- 2401
- 威望
- 1647
- 贡献
- 1349
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
% O9 E+ r5 p) ^5 z! `" ` c pageencoding="gb2312"$ d# ^' f5 g* s" c
%>
! k9 V7 Q1 N6 u" _* S& g% r( W<style>" c) m# r" g* X" G* h- G
.f9{ font-size:9pt; }
. H) l% z, m5 M6 i, W* e.bgc{ background-color:#aecaf9; color: #0033ff }& f) `( M; l5 D0 F/ [# X8 Z) P
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;( [2 [0 D3 K+ a1 D
border-bottom: solid 1px #4e7dc1;8 o% K, r# Y# d: R) W t p' a
border-left: solid 1px #aecaf9;
9 D& ~1 z& T6 x) b6 R border-right: solid 1px #5679bd;3 M1 T0 k' j x$ o' B b5 b
padding:1px;5 X. W) J( o" C3 B" M o6 s; p6 s
margin:0px;} J# A" j% m: Q3 u2 k$ G f
</style>
+ s+ l' u9 ^ C' B( E) i$ F<script language="javascript">1 I8 v# o* Y: g6 X9 k; Z8 j; G
<!--
) l* h6 n6 T/ rfunction rv()
( j5 ?. p4 D: {9 ~1 p{
. X+ m4 C- h- d; r var val="";+ T) ]: y, C; i: q" _; h
for(i=0;i<combo_box.list2.length;i++){, s- T1 h* n* n3 @( y# P# W d3 ]
val+=","+combo_box.list2.value;; c- U, a# ` E! {
}1 g' s* `9 ^# v* F# V _; N
if(val.charat(0)==","){9 o8 U3 x" T) R4 n# D. r
val=val.substr(1,val.length);6 o% q" i7 w# P* T7 H
}9 c, Y8 ^* Z. _5 b$ d
opener.form1.frecname.value=val;- l I- W) a+ \2 O" J) C
self.close();; P. L6 ]. k; t) H& v
}0 q$ e5 m" h0 O; W M
//-->
9 L# M6 F- | s" n# K% X% W, f* R</script>
/ ^9 s8 ^9 g5 p' P) a: u$ Y" e: o<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">7 i$ R& k, l7 M, V! X
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />5 t& ]0 H$ f# q6 n. n
<%+ `+ z5 h2 K& g
cdatasource ds=new cdatasource(); //数据联结bean实例( ^9 \# m- ?* N4 d: F) T
java.sql.connection conn=ds.getconnection();
# N" V$ u" K4 i/ z j T) L java.sql.statement stmt=null;
/ L( U6 m& _# k; a! S& s" K; g java.sql.resultset rs=null;
* e+ _ z% R% \ O cdatacheck dc=new cdatacheck();1 O$ `' ` f2 J
%>
7 x6 y% F% G/ G; v7 M<%
- z. [5 |4 q* Y5 \ Y7 Y6 l Estring 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";
. B1 t. n% j* e0 I" ^stmt=conn.createstatement();& t( e) A7 G) ^3 ^9 N( x! U+ x
rs=stmt.executequery(sqlu);7 G+ G) a' S$ s0 }
%>
6 e9 _- b; E5 z9 |4 X4 I- k<script language='javascript'>' P+ R ^" B- @ j
arr = new array();
* S$ a2 h$ e' _- m; u0 J0 t* q$ }! i8 K<% int temp=0;: B, F( |( i7 |$ x5 c
while(rs.next())
' x* b- S8 O- L/ f9 u6 ^; h- T a{
2 A3 t. Y6 o" ~% P%>
; q; Y2 K" d* m4 l: ^arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");4 f. {8 p7 B8 U! r( G; @
<%
1 X! T7 @+ w4 \( s( Ztemp = temp + 1;
6 b! v0 _6 ], @5 a, @* w Z9 s; R}, S' w: X* o4 ^, X) k$ o) V8 S: h
%>3 Z+ j- ?& P$ g! m! j0 c0 E6 R' t" y
temp=<%=temp%>;) Q D* j# U8 M; g* L" M
function changelocation(id){ : K9 P/ h. i% G) O# X) W$ m% V, Y. X
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
% |, c. f$ i$ D/ \# I5 T8 gvar i = 0; . i0 I6 Y- O# T9 J" s8 Q9 F
document.combo_box.city.options[0]=new option('-------','');
! ^, `% \/ u! {; g% U! yfor(i=0;i<temp;i++){
5 t) ]- G8 y1 u0 H- y* [( P1 Qif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
+ [% F" u4 P: g1 y% m3 @document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); ! T0 H. R- u7 N. g1 `
} ; P# c( s" O0 U9 K! |% I
} - e4 Z8 }$ o- ~" c
} & ~$ U- @. z7 g
</script>
. E0 v0 _4 O' c! e0 }. x* J9 c9 p! T8 G- w
<form name="combo_box">
, L0 h' T* l. ~+ e6 g<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
' _& r/ ] v, d7 G <tr height="24">
) l- ^# F& r3 m# D/ K/ r <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>3 {; q" I, _/ H- q
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
& U: o' I* F7 @! {& R$ ` <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>2 |" d" u* p% o1 i4 U1 ?
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
5 }% Z4 E' a* n6 T, w- n6 N </tr>7 L+ r; H4 a# ]% ^* U
<tr> & s0 V6 C" D% L
<td>% z5 f* ~6 G; V0 d9 ^0 m4 R
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">4 B. Z$ _0 [- l+ U
<option value="0">请选择部门 ---></option>- { \3 _. Z- T7 l% A" O" b
<%4 [6 t y# s7 @. @4 {7 R! A
string sqld="select * from tdept";
- s9 ^1 V& @3 @+ I9 [1 Tstmt=conn.createstatement();# i# M$ l g6 U+ Y b! q$ H. M
rs=stmt.executequery(sqld);4 y( b2 k7 y: @% `1 h6 C
while(rs.next())
& g6 v$ {" \- ^" X8 t{4 J4 r( C% o" \& V( n0 K; T
%>
! c6 Q6 [5 c( J* a( b' X/ ] <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>2 o6 ?, Y) l1 C
<%
; }: I; C+ c L3 x}# V, P' q8 `2 V6 _; w6 T. w8 ]
%> & n4 f/ D8 J* { }+ P! ^5 w p! v
</select>
/ |5 \3 C/ h6 ^* Q: F</td>* I9 ^% u# M3 S' S0 n, \# Z
<td>
. a, I) V6 l5 m, `) l6 I. b <select multiple id=city style="width:150;height:200" class="bgc">/ m' G& H1 k( P) N/ Y' J
</select>3 [$ f: k Y( H' O6 ~ B7 b! M+ j
</td>0 J% x# m9 t) o
<td nowrap align="center" class="bgc">( A" Z- }) \- ^& [9 L0 f8 l1 h: P/ d
<input type="button" value="<<" class="buttons">- j0 K0 F( e; U. H7 L
<input type="button" value=">>" class="buttons">/ c* @* N2 h4 l' d+ H; v6 s/ d; A
</td>1 q0 a- [" {+ N$ m4 r3 B7 T
<td>" i# G0 ?& s4 D
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">1 q+ `& V- o, L
</select>
. J2 w; B& ]* _% } l+ z [</td>
! g* A+ Q- j+ ^ </tr>
+ C2 ]+ Y$ q# o1 b <tr class="bgc">
9 h5 b7 Q6 y6 [, U1 K G <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
& M; M" ~% w/ V5 e0 [ </tr>
" S3 I6 B8 {: |4 m4 R* U4 h! ]</table>
3 a9 O' L" l/ \( N5 l</form>
3 D, h1 _9 m) m5 n+ v4 M( Y<script language="javascript">
W2 |% D4 U! F1 w//人名移动1 X' L+ G/ Y- N
function move(fbox, tbox) {
4 O; ?8 z: r9 g* V& s2 t6 N% q5 \var arrfbox = new array();: E q/ _; X4 z* ]4 e: @" e0 N- r% ^
var arrtbox = new array();& U4 k) @! l i: I& i2 f
var arrlookup = new array();
! Y( w6 ? C* `" _6 Yvar i;
( A( k1 ]$ B7 W6 e e* P. f- w- pfor (i = 0; i < tbox.options.length; i++) {0 g: I0 Q$ K4 D7 R9 H' C% g
arrlookup[tbox.options.text] = tbox.options.value;
0 |( }. ^9 Y# ]7 xarrtbox = tbox.options.text;4 ?6 t; U8 ^2 F7 e
}
- E$ t: Q8 a0 v( v; V/ Jvar flength = 0;9 c' f* o/ M# {) W# R( \9 ~& p- R W
var tlength = arrtbox.length;2 ^6 L8 u/ J+ F, F; k: }
for(i = 0; i < fbox.options.length; i++) {) u2 r, S4 w$ C$ f9 ~
arrlookup[fbox.options.text] = fbox.options.value;2 I8 h. H8 R9 t" x) j& ~
if (fbox.options.selected && fbox.options.value != "") {
# |8 x6 k: ]+ ]% i" [arrtbox[tlength] = fbox.options.text;4 o1 b# A4 z! i6 B. o
tlength++;
/ H8 q3 d8 |. L/ |" W" N0 E}+ L; `* x+ }$ `8 ?/ j: H9 S$ S
else {& u5 c: d- ?- d5 z) u' `
arrfbox[flength] = fbox.options.text;
- _/ U& ^0 e$ B Q9 q. Qflength++;' d: s5 q) C" { g; I6 E y" _
}1 e, `( }4 t/ k, a3 y0 X x! K+ ^
}
) S& [ r& S: a1 U2 v* z* Marrfbox.sort();
1 \' P1 I h3 S# }0 v& Yarrtbox.sort();
. {. O; D# B8 m/ ?" R0 T( q. p7 Y O; g* ?6 ?) f- z% _2 n- s
fbox.length = 0;6 R3 u n) f7 R
tbox.length = 0;4 m5 G7 _0 A) z( S2 r/ z$ _) t8 n
var c;1 n$ H G( Q3 M, i
for(c = 0; c < arrfbox.length; c++) {
4 p! o5 N4 }& o- [7 G; B) Jvar no = new option();
3 E _" A# g* Y$ {6 b9 h' gno.value = arrlookup[arrfbox[c]];
" w0 w/ a( _$ F8 W* P: }0 Kno.text = arrfbox[c];
7 k ~' [& G, y# tfbox[c] = no;; ~# g! T3 |4 G: G2 [
}% g( R6 h. |3 o7 }! ~
for(c = 0; c < arrtbox.length; c++) {+ M8 \+ ?( d* l* b
var no = new option();
# w6 H7 t0 ~' n% _no.value = arrlookup[arrtbox[c]];6 ~) p: @1 ]4 e! v7 n- |
no.text = arrtbox[c];; Z( H1 w. t) y& s
tbox[c] = no;
- i% t8 V8 M! H }% D5 x. ~8 p) P: F2 ?2 Z+ W
}3 ~) y0 a5 C( O
</script>
" {/ p% ]0 [2 _! H1 G</body>5 X3 M* B* B) u6 v H4 @
|
|