  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14249
- 金币
- 2415
- 威望
- 1647
- 贡献
- 1363
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
5 ~1 n% s6 r- m7 G9 Z) w( S c pageencoding="gb2312"0 Y, g2 f, C6 C5 r( |& L
%>/ |; ]$ |4 l% n% ?& R$ V4 y7 c4 a
<style>
+ }% n2 D7 x- u, Y5 z# [5 C.f9{ font-size:9pt; }
1 B. L p8 G0 |.bgc{ background-color:#aecaf9; color: #0033ff }
" p2 r6 D, s: d.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;1 G6 |$ a6 P* h
border-bottom: solid 1px #4e7dc1;" [* [' G8 @' C% c
border-left: solid 1px #aecaf9;
! e) p4 N" B% n2 B- `! ^: p border-right: solid 1px #5679bd;
, k) d8 x. N2 @9 T: o padding:1px;2 R: `; Q3 m% `8 u( U; z
margin:0px;}
; ~& b5 k5 q* Y8 K0 E$ w$ V: O3 {</style>
/ ^/ z6 I) R5 ]6 X. v8 [2 }<script language="javascript">
+ b! q9 Y- r6 j+ Y<!--- Y: ?0 }- Z' }7 N9 T: Q+ [
function rv()
% {4 l- J9 Z/ B3 { s. X{
6 }5 X" S5 }; B1 o var val="";
) |6 q" k* ]+ ]& b' s, n# ]: Q for(i=0;i<combo_box.list2.length;i++){. O+ x5 Q4 P1 Y! ?6 C
val+=","+combo_box.list2.value;$ t) ]6 S: T0 Y" v3 g! x# [
}
. _( B; H! X7 X" Y; _5 Z: o5 m' ` if(val.charat(0)==","){4 t! I6 \. v* z* K
val=val.substr(1,val.length);: E/ G$ `: r6 b9 o: p
}
" S& b$ d+ y4 p" C+ O7 Q opener.form1.frecname.value=val;
1 `$ E) i" U: @& B self.close();7 z7 q0 \5 _. x# M3 g
}
7 I( [) o# o7 P* D5 i* K//--># y: G+ ?6 ^6 X C6 ^
</script>
# R! H9 M. v8 {' z<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
# P1 P, a4 [( F" S* U$ R<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
6 f$ c1 J& f( m, S<%
* E$ N# T: i: ] cdatasource ds=new cdatasource(); //数据联结bean实例6 y# `# r# A7 M- [+ ?# S
java.sql.connection conn=ds.getconnection();
5 y8 H% B, F* n* X; P java.sql.statement stmt=null;0 S- {& e4 p# C* x% z
java.sql.resultset rs=null;
, |8 C: k& R; U& `% E. x cdatacheck dc=new cdatacheck();( [# n5 m/ q9 r/ k: `3 [9 p
%>; U% j0 B1 n% e5 @! I7 m5 C
<%
3 T5 b' {& W7 e1 h) K% Y: q8 ostring 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";
: C9 ~ v6 b, Q* ~stmt=conn.createstatement();1 i; | Z! e5 e# s5 \( t
rs=stmt.executequery(sqlu);+ P, k$ D$ o9 d/ ^: U# t
%>) N/ d! O: g- y& H& A6 O
<script language='javascript'> _' b" s2 Y3 y0 B/ O% s: S; I
arr = new array();! Z3 {; ?& G* H$ ^1 t
<% int temp=0;
" ^: ]* H9 L/ }+ X0 _. R) a! Twhile(rs.next())
3 j0 ]1 f. l, t- v{
$ \0 R D! n1 g" v%>4 q' S2 C1 c* h' V
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");5 F8 D- b6 Q* O* @5 h- o
<%, y6 I6 P1 P. e2 y
temp = temp + 1;% Q; x% J# V: \. r* f' w/ V
}
$ A2 j$ r9 A9 y' F# u%>& O2 ] i o2 N: m* i+ ?
temp=<%=temp%>;) S; R9 w# o, S2 {( O
function changelocation(id){
: x4 a1 U8 N9 g, ]5 Ldocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
9 v3 S/ T z, d' x* N+ Ovar i = 0; ?) v$ u; K {7 [
document.combo_box.city.options[0]=new option('-------','');
& Y8 s* S/ @0 Y3 s+ h. Kfor(i=0;i<temp;i++){ 8 P q' t" u8 U" s# e' h
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] c- D' o4 u1 I7 W0 E1 \7 C
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); . z" d& B M6 ]! M. @( ?) I
} 5 a* w$ e) V7 O9 w7 q A# _
}
1 w( H% [& \' o' n}
4 l8 V" h( ?) e) D</script>
3 s- t! v0 D# L' W5 C: V
; p4 h: I& G* d/ M" z<form name="combo_box">
; J! Y2 h/ b2 D% R<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
% {/ F# B+ Z% X2 W- `) O <tr height="24">2 G. n7 f' ~ C/ U7 _
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
3 [6 L1 Z: C m <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
0 i" d8 l2 ?$ X# t6 r0 t <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>' s2 V, p4 f5 a
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
1 F! u: I! e1 v! {% c7 O# M6 h </tr>
: C9 ~! N9 s8 r, b <tr> ( J! @. c/ i5 u0 a2 Y( N, T
<td>
. `2 t j" W9 d, w# o H4 l6 Q) \ <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
/ O, Z. ~% |- _* m7 P! E( t <option value="0">请选择部门 ---></option>0 }% c* `% Y7 b/ O5 `) R+ o9 ~1 O
<%
3 P/ g1 I. d6 ^ u+ k4 ~ string sqld="select * from tdept";% A6 }4 i4 Z* ?4 q3 {) k, \* c5 j F
stmt=conn.createstatement();# l. l- [" P$ A, d" N' C4 R _
rs=stmt.executequery(sqld);9 R! K; V4 g0 q R4 C/ w
while(rs.next())* z, T9 l+ _/ J- R
{
& @5 o; q5 Z9 g0 @/ f( k; C3 n%>
' ~' v$ ]1 Z- ]$ e+ a <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
' ]) R% E# ?% J0 y$ x* G<%' Q2 H) }1 D4 v$ P- X
}
5 C n3 Q7 O+ [# ^%> # R6 j4 ]) P% _9 R
</select>
) ~3 R! ]2 T. j4 l8 [' D0 y</td>9 G' ]' n/ w/ j5 b) l, y# |" Z
<td>" `/ [4 A3 z$ d! e) n) V
<select multiple id=city style="width:150;height:200" class="bgc">. b# Z3 G9 U# v" H% a% S
</select>
h3 y9 r3 }, a0 d9 S- N</td>- [ V4 B" c, y' \) G( _7 d
<td nowrap align="center" class="bgc">( t4 f6 l8 c$ Q
<input type="button" value="<<" class="buttons">
/ Y7 n X$ [; [8 T1 C <input type="button" value=">>" class="buttons">8 w7 A' O. _) r6 U" y: F- l) \4 x8 ^
</td>4 U; w A& R3 Q* Z. t
<td>
7 v: t! z1 f; E4 B: Q <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">8 \' Y+ |: q q, L7 x- J% G
</select>
6 c5 p! ?" i0 ~4 l& W; L4 X</td>
1 C$ y, _( Y7 S/ r/ N4 i8 U6 Q# ] </tr>
( c v, G/ y+ W9 p" X: V <tr class="bgc">
- M) Y% h9 ]/ h- @: g6 ]/ M <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>8 P7 @) ?" [# E I5 ]% s
</tr>
+ ?& f8 }* X8 I* L</table>
2 C1 y8 x6 l: }) ~+ N</form>
4 z& |" d1 S$ k/ ~<script language="javascript">
$ r/ a$ D) U) E# }//人名移动
- W7 q/ t6 j. T2 I* d4 Z8 Afunction move(fbox, tbox) {
% i) ?9 b) J6 U; d; r6 ]1 E2 z! T+ Gvar arrfbox = new array();
; J$ \0 [& L7 O7 u' _8 l. [+ mvar arrtbox = new array();
/ W+ `# n2 [5 j) pvar arrlookup = new array();
; y9 {7 K3 ?* avar i;0 v8 D) B/ W+ e' X* i
for (i = 0; i < tbox.options.length; i++) {8 T3 |4 Q# x; T: b, B: f
arrlookup[tbox.options.text] = tbox.options.value;2 S0 f9 y0 X" e3 s. a
arrtbox = tbox.options.text;( u( y; I: y4 t# Y/ D5 ^; F" P
}
) g. F9 B( ~/ P/ |- dvar flength = 0;
9 {- Z1 C. K8 Y; z& p% Vvar tlength = arrtbox.length;
- [/ [ h$ X: T9 p" I/ c9 ^* wfor(i = 0; i < fbox.options.length; i++) {# k- g; u4 {* J1 d9 X4 |
arrlookup[fbox.options.text] = fbox.options.value;
: s$ C: O, u/ r7 c7 U6 d- Pif (fbox.options.selected && fbox.options.value != "") {0 j/ [' f' N" A! ]3 W: d1 a
arrtbox[tlength] = fbox.options.text;- b1 g$ t& J3 t
tlength++;
7 I2 S- p( L) \" \ ?; s. F% ?# @}* I3 }. S0 \# {
else {
6 k/ O; V' N6 earrfbox[flength] = fbox.options.text;
* f5 c4 D6 O: ?3 nflength++;2 A) b8 M1 ~# \8 n u7 [9 M
}0 p; m/ P2 ]* @7 n9 }; S; o
}
+ E# `7 s4 t1 z( e! Z5 _& jarrfbox.sort();
( q% {* o! n- I3 W( s$ r$ A5 yarrtbox.sort();
0 p2 ?: E" m' \% K# c; ]( ~& t
$ ?5 P- o6 O$ L' Qfbox.length = 0;$ C& k" P" Y# J% f5 G# i8 o
tbox.length = 0;% }6 q" X; Q, _
var c;
9 H! e$ ~# s0 Z! e( j' h/ l' ufor(c = 0; c < arrfbox.length; c++) {
" k( i" g4 t/ Yvar no = new option();
2 M8 V/ |+ \4 y' S, s) Y* _5 s; }no.value = arrlookup[arrfbox[c]];
8 X8 V6 p* {2 c6 @no.text = arrfbox[c];
1 w0 g+ b/ p6 I3 ?; @8 {fbox[c] = no;! A& i9 [7 Y! x# c
}
/ m. c9 t. h8 y4 s, {5 {* E/ Nfor(c = 0; c < arrtbox.length; c++) {1 [5 C9 H5 N2 a' t- w. g6 [9 ]
var no = new option();
1 F+ T: {1 i% c* u) b: Nno.value = arrlookup[arrtbox[c]];
7 ^7 c- S& E; B( l' q# \3 Q4 Gno.text = arrtbox[c];
4 H3 \+ [! e$ Rtbox[c] = no;8 ]1 X3 b% W1 ^: b$ R' _1 G& h/ d: Z: e
}# h2 P% d5 \ G0 a' n) F
}+ L0 ~3 \3 U- X4 Q2 f- w! i! ]
</script>! |$ v( G8 s8 @" E" y
</body>2 K1 j: ^3 L3 S9 O3 [) i2 |- t4 x
|
|