|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14399
- 金币
- 2485
- 威望
- 1647
- 贡献
- 1433
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"+ U/ X& U7 _% L" E
c pageencoding="gb2312"
1 x) X1 q* O( C# k' U%>* n: S6 j$ |: T+ l( T
<style>
$ u" I% D$ P& F- [) [.f9{ font-size:9pt; }
) X2 {7 A G! a+ I/ e.bgc{ background-color:#aecaf9; color: #0033ff }
* _. ~1 I6 A. s R.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
6 t% l8 ^4 d8 j( v border-bottom: solid 1px #4e7dc1;
$ [/ ?& h8 u( M: e. ] border-left: solid 1px #aecaf9;
6 a; T. o) m& p$ k/ I' x2 p8 A border-right: solid 1px #5679bd; |7 e2 X/ }; A; U" i) A! I0 N
padding:1px;
1 f% _+ u! b2 M1 D/ `* _7 m' Q margin:0px;}$ L, s/ q6 K6 a& |- ]
</style>
. ]7 ~8 j5 @# P2 n9 f<script language="javascript">
% p' d+ G+ ^8 b2 L- v" j n<!--& K R' G! O) d$ B" L1 K5 Y
function rv()
; L9 ~. y9 ^- [: i, W5 V# s{; J6 {5 x* b. o/ O/ E& v/ v
var val="";
6 q. t' f+ @+ e2 J" m) ^ for(i=0;i<combo_box.list2.length;i++){
3 g& I* D9 g7 J. ^$ g val+=","+combo_box.list2.value;
2 h6 w- s) j3 w2 C% o8 K) ^ }
. D/ l9 r& R" l if(val.charat(0)==","){
( _/ T/ C& i1 w- u+ P$ P val=val.substr(1,val.length);
' W7 W% S; q. h! w3 b# x, T7 |0 T }
/ ~6 y, `$ q* l2 s opener.form1.frecname.value=val;7 V3 `4 f7 o4 I# h$ r
self.close();
6 [5 S- K' a j1 a# J}
" d. z' y! K& {6 `) Y3 {! E//-->
( L# w0 T: b! h7 X% N8 Q) `6 | U</script>
, G4 P4 B% t9 B& r+ Z<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">* R+ s: B/ }( T# ]
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
* j, i& l/ E9 \5 B( }<%
* f5 |0 `" U- _* W2 y2 Y cdatasource ds=new cdatasource(); //数据联结bean实例 m- `+ ^8 d* k4 c# U1 t7 |: `. R
java.sql.connection conn=ds.getconnection();
- M, o _$ U9 X; I5 d# S java.sql.statement stmt=null;
! N, t7 y! C. W# W- w java.sql.resultset rs=null;& {8 k6 x: p7 `4 E9 x$ O
cdatacheck dc=new cdatacheck();: C1 L% r5 f" p9 c: e
%>
- @1 d% l! z7 p% |" m Q1 {$ j<%
+ Y& ]5 Q- z* P) _" N. @7 wstring 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";
5 G' g" P* y0 q& Q& {) [$ Ostmt=conn.createstatement();
8 E; g4 l, L$ x+ T$ K# xrs=stmt.executequery(sqlu);, c9 w; X' k+ u
%>4 ^. D5 L5 E* {
<script language='javascript'>$ d, J! W( z5 ~6 k
arr = new array();5 M+ ?5 ^- S. l1 E2 L
<% int temp=0;8 s- e8 q( g4 k; M7 ^) a( c
while(rs.next())
& y2 U# u- u/ }9 z1 z{
) M, N5 K. ]6 ]8 I$ a* j%>
# C* ~$ d6 Y, S( z6 qarr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");2 Z3 b, W/ A; d- X# Z8 C, P' X
<%
7 `! I O' g6 P7 ztemp = temp + 1;
0 v3 [. v* |$ _! E}
- v+ s) ]7 ~: V5 Y0 h, o$ {; U Z7 a%>
( G& c- Z0 m4 Q7 [* ]9 T' }temp=<%=temp%>;
: g/ Y+ ` S1 T% q! R0 |5 K) ~function changelocation(id){
1 Z7 g3 T$ N% H6 y1 Fdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
* o% @" K& v6 M) {2 y* fvar i = 0;
+ p9 ^* ^$ P$ ^/ Sdocument.combo_box.city.options[0]=new option('-------',''); 8 }& j2 U9 u- o& A/ k* v7 Z& r
for(i=0;i<temp;i++){ N2 y4 @; o& {8 i
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
! |- O, X+ \5 s) k! N: Y/ m3 Bdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); / G; S2 E$ m2 U* Y; p0 s% C% O
}
6 Z4 f: Z1 k9 T! g2 N} & f1 c7 c( w o* P! F" t) _
} 8 R0 \1 z9 f6 \) \
</script>7 O1 c! h1 F Y7 @: W$ `
, K9 f& x8 C% C0 [1 I7 s, x
<form name="combo_box">
* `( w% ~0 P) f/ C) o# {# X/ G<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
+ `/ @3 D, ?/ k, P <tr height="24">/ N c' C/ `% r' {
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>9 t* a5 b. ^3 L8 k& q: o, t
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
- t$ ?- j7 \& A5 \ <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
- m3 g, v) t) z; x7 j <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>% I! b5 m0 D5 @% U) f
</tr>* L% H/ b2 W. L+ M8 F
<tr> . \. f3 Q& t$ W/ Q* ^ f6 m' u
<td>
2 z: R3 B! |' I* N/ @: m/ O6 N <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">: c8 l0 A3 H: v$ P; n
<option value="0">请选择部门 ---></option>6 h0 I, _: V& ^9 \ q
<%
+ J d. ?8 J! } string sqld="select * from tdept";
$ ?2 B' b8 {$ ~5 rstmt=conn.createstatement();/ b! I7 }. `$ K! h
rs=stmt.executequery(sqld);
/ n. z9 k `( Gwhile(rs.next())% |! v* o9 s B. n0 D! }
{
" _ U. N* w9 X* q! g' Y3 J%>
2 _: H# _ {* F! k% p0 t# s' z <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
9 u3 M2 Y* k; x2 Z. Z6 g, ?& |<%+ q1 O: X0 n% \
}# \6 p% z- f2 }- G5 ~$ J
%> 1 E2 W3 w5 K! F& f+ e& H
</select>) N4 N9 F+ |( @0 J# B4 X
</td># V2 U4 w6 d" A" P* j" s- S
<td>
" ?# r' e; N8 j5 B3 {' c( q% A& s& W <select multiple id=city style="width:150;height:200" class="bgc">
% l, _* z5 x# ]5 L9 _ H1 W </select>; [& r2 n, C% {$ T0 ]% N0 n
</td>
+ N! @) b S3 I# H <td nowrap align="center" class="bgc">
& x3 ~- G" Z$ ]' h4 r+ ?, H <input type="button" value="<<" class="buttons">
/ L5 v3 i. G) p n" z% g <input type="button" value=">>" class="buttons">' L" G, y9 }+ q0 _5 L7 G
</td>
7 n+ ~% g" c7 B+ e0 `! N <td>
* {% F* [& _- e" p5 H: k8 s <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">/ B* o0 q: ^0 |0 y5 P2 n
</select>
8 f( U7 f b; [. x3 M</td>
% }/ l. [$ T" K& P4 B+ a/ F# L </tr>
0 b2 m, Q+ b; i4 j0 Q/ m5 e4 F' B <tr class="bgc">
0 F% z+ ^- R6 u& K5 ~ <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
$ j" P# Q; H# P" y* R% v- A </tr>
8 x. b( Y) n3 z8 {$ H</table>3 q: w% U) y! j) H' ~
</form>/ [1 t+ M1 I! p u
<script language="javascript">" S" Q8 H! |" P i
//人名移动
# X* D8 ~/ Y4 W# j+ Hfunction move(fbox, tbox) {
* J) V2 h! s7 X7 I4 U9 Tvar arrfbox = new array();* O7 E% R! q" D& |0 o) K
var arrtbox = new array();
* }# J M6 V( s4 ^* kvar arrlookup = new array();
E* v5 y! M2 Nvar i;' X1 h( N' w5 K( v4 Z
for (i = 0; i < tbox.options.length; i++) {1 j% S$ A0 h1 E3 J; ? b6 d. h: O
arrlookup[tbox.options.text] = tbox.options.value;6 v8 O7 j* h; U K
arrtbox = tbox.options.text;
3 m2 E+ M5 ~ Z; F4 K% ]. T}7 x( a* A# L8 f9 O
var flength = 0;
8 Z2 V) n) i" }/ _) yvar tlength = arrtbox.length;9 F' x% O- Q5 M+ K+ v6 Q
for(i = 0; i < fbox.options.length; i++) {
( y# Y( T5 ^. V' ]0 \6 earrlookup[fbox.options.text] = fbox.options.value;/ n. }' Y) v& C$ {) j, y/ I
if (fbox.options.selected && fbox.options.value != "") {7 A4 m: e) W g* j9 u' z8 b
arrtbox[tlength] = fbox.options.text;0 Y$ R( ` |, @& T4 V- F# s. j8 @
tlength++;
# a; S$ c* l* _' T6 h% b0 L4 u$ Y3 m}: b$ J, @" r( d" F
else {
) P7 C4 J: r$ ?1 qarrfbox[flength] = fbox.options.text;
$ J3 X. q. Z y- F- h/ D- {flength++;' ]0 p- F: E% }/ @1 E: H
}4 }) I6 [) ]/ I8 Q3 P
}
$ h4 u: A1 c* V: iarrfbox.sort();
& f: m6 m0 H" iarrtbox.sort();; j w9 C$ j/ h
) F4 ^- L! W4 T# |fbox.length = 0;( y9 M( N5 L" i0 x$ h
tbox.length = 0;# B& K0 [! F3 T1 k3 H0 V
var c;
) b& h% f! D6 O. V, s* N& Ffor(c = 0; c < arrfbox.length; c++) {
8 u8 W- z% X! m7 g* u; E" n" v. ?0 Cvar no = new option();
, W J ^/ x) A& G. K7 Dno.value = arrlookup[arrfbox[c]];
, {- L0 x* j* eno.text = arrfbox[c];
+ \" E+ Z* Z: E' f8 ~- [fbox[c] = no;
: n4 H( K" h# z& R. ^: H+ N}
& L$ I1 y% p$ ]0 \/ S& m2 n! ofor(c = 0; c < arrtbox.length; c++) {
, E, h& G3 i7 d! x2 O2 G- avar no = new option();
0 g( v3 }# k3 U2 T( J3 n5 kno.value = arrlookup[arrtbox[c]];, c6 Q- ~" b0 \+ |4 O- w. k
no.text = arrtbox[c];
1 g" E8 K k% g! Itbox[c] = no;
& G0 n4 H' h2 g/ d }* e4 r* J) |, A+ o ^) ^
}+ |+ Z1 f( Y# }" B; e* q* R
</script>, L5 ^. l2 V- p
</body>2 }) Y- S( c" m' g- U5 l5 t$ R
|
|