  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14221
- 金币
- 2401
- 威望
- 1647
- 贡献
- 1349
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
0 r# A$ j4 W7 y) \ c pageencoding="gb2312"
% K9 ~/ U: N- R5 M5 H%>: V; U5 V9 D7 \/ K' v2 ]/ ` i
<style>
4 S& S, Y4 {2 A+ e3 [ X# }.f9{ font-size:9pt; }
( h2 Z7 L" X, F6 |.bgc{ background-color:#aecaf9; color: #0033ff }
1 P! s( B; O1 q1 W9 g' {1 c.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
& F$ r i& I1 `9 V border-bottom: solid 1px #4e7dc1;
1 v3 c9 M6 Z' N0 g* U( i' { border-left: solid 1px #aecaf9;! A& T* s4 K7 j1 W9 [' F
border-right: solid 1px #5679bd;" O' f1 P) X; Y0 u( }
padding:1px;
7 s6 D% {7 U# i: V. g margin:0px;}
& s) t8 q1 y E6 u</style>; P% K; t* K- w$ {$ ~, q5 \: i
<script language="javascript">
& q. S' A' {2 C& b8 l# Z<!-- c' Z) b$ ]* g; Y! |
function rv()
. e% c4 e8 K3 @# \{
6 S# ^! g3 r0 M) _0 } var val="";4 _5 V( Y$ ^0 d. n
for(i=0;i<combo_box.list2.length;i++){
6 v! B; L& j) P7 M1 ]. g val+=","+combo_box.list2.value;* W% G5 \. ^4 x
}
. r' h3 M4 v+ I) s if(val.charat(0)==","){( q3 b4 {/ N5 X. L# u
val=val.substr(1,val.length); ?& W. ?! ]( K* Z
}
" ]3 S" E- V$ _6 R& F opener.form1.frecname.value=val;
1 ?. B' ]2 J3 e& X/ K8 M1 e; V self.close();6 @9 r! A& \! e5 ^' ~9 _
}
1 y6 o s9 l- s0 B6 D0 h//-->
; m- j( ]3 f u+ M+ _# ~</script>
: O+ @" k! X- ?8 G! N<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">! j2 ~4 ^& R& t
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
. h& K8 x# c" @$ v" Q<%. z) |5 Z5 k" `2 a0 `( Z
cdatasource ds=new cdatasource(); //数据联结bean实例, a W' S1 t M4 D8 G8 K
java.sql.connection conn=ds.getconnection();' v* U0 i, o: C' l) Q
java.sql.statement stmt=null;
/ E+ s. h/ w) N4 o7 t java.sql.resultset rs=null;
6 f" D# r+ V8 C3 R/ m. u- z a$ o cdatacheck dc=new cdatacheck();
7 F7 @, u" C7 m/ ]%>& i8 s% w' o2 z4 M0 i. W3 {
<%
( B! E8 Y& e4 z7 L- ^: C0 @ dstring 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";7 |8 {* c' T' U
stmt=conn.createstatement();
- K* q6 f. Y0 O# i' @% S4 `5 u0 D6 prs=stmt.executequery(sqlu);! c9 Z8 V; {: X3 i
%>' c4 z2 N4 ?6 Z* N; F' V
<script language='javascript'>* K* k5 E( \, ?4 p
arr = new array();
s" O: W! e6 h. Z: D<% int temp=0;, Q5 d5 V" m3 m
while(rs.next())/ v; J: r, [9 v- N
{
0 ^4 y% T2 P, M. j x6 b1 {%>
- h8 p! \+ a5 ]arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
' U, W* m6 J5 g1 j% f) X+ }' q<%+ }+ s; {' Z4 j; [6 D! l; v
temp = temp + 1;
9 \$ @' p7 {5 n, A9 M' q6 N}: | t! |+ {, D0 E+ R& G3 Q3 j
%>- z. W* X2 k( ~& O. Z
temp=<%=temp%>;0 q+ ?2 K0 T/ G: H+ r* i. y7 U
function changelocation(id){ ]/ t# H( L4 u4 i/ O+ u0 m* @4 }. Z
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 , h7 P% p2 n9 P# r' D
var i = 0;
) i3 m: I8 G( }document.combo_box.city.options[0]=new option('-------','');
/ |6 i3 G/ P! Q) L1 d2 D6 f0 nfor(i=0;i<temp;i++){ $ h r! v* L* O: k) H; W6 v
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] , Y n$ \: J" d/ w. D/ M
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); m9 N! q! g/ a
}
) |) ~5 d$ F5 i7 ]! d1 }2 }1 i! t} : z( A4 Q' V3 T) T- f7 v
} 4 ^/ n( y" c6 B7 _/ `9 f
</script>" y$ r5 [' {4 L# |7 s( l% s+ `
6 f# p- P% N" }) y2 U<form name="combo_box">
8 I1 \" ~# b; e6 k n3 o<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">* c- r2 b" p$ F6 }9 w5 t
<tr height="24">2 ]7 F3 C& K0 s1 R2 k6 _9 m, S
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>4 X6 T; C: h, z0 x5 _
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
- k# m. [3 y6 o+ M9 D: z0 j2 G# } <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>' O' ~- O+ s5 ~2 E
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>1 q- Q4 V: T5 I
</tr>
8 |" V5 Y4 j+ |7 n" ? <tr>
+ A% c, w8 w3 V- \ <td>
1 S% X( E8 @; [, t; I- o$ F <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
# O [8 g$ m, H0 O0 X <option value="0">请选择部门 ---></option>
- V2 \4 T/ N2 Z% z& ]" n8 ~& y9 _<%
9 I) S* x1 z6 q* [$ I7 J& p; L string sqld="select * from tdept";3 I$ x9 L+ E9 x5 C1 U7 p7 j/ }+ ]% e
stmt=conn.createstatement();6 Y. e5 a2 o% y
rs=stmt.executequery(sqld);0 m. h" T4 \) h( e @( a$ ^9 S- X
while(rs.next())! m9 x% G6 i$ g, G2 a+ w
{& u" @/ y8 w- i3 {2 t: b9 P+ D
%>' j. V# I+ ?4 r' _4 | {; y9 ?. w
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
0 j4 e! R; A; G5 D! ~3 o; T<%
5 }( s* S- w4 Y ]7 R( a' w/ {}' ^2 l: e# Y- H1 N! H" T* X
%> ( p4 d, b; D, {& }% N* Y
</select>; d6 p$ }; [. D* P# _# K; A8 n
</td>
1 ~1 ?" _" O- B <td>
8 y' G2 T/ l4 S2 _4 c0 g <select multiple id=city style="width:150;height:200" class="bgc">0 p, ]9 c0 D3 _. E
</select>
) s, s5 H" i. Z" R, H- V</td>
* c& g) L& f# z6 l; @$ D, \( O <td nowrap align="center" class="bgc">
! U$ _, U) M6 Z* C* D8 \/ a ?- h <input type="button" value="<<" class="buttons">' Z+ G! G6 W2 Y9 }9 @7 u, d; _1 X" G. t
<input type="button" value=">>" class="buttons">
: f/ Z3 [) Y2 i: P1 F7 p</td>
) W; }+ ]( z& Y: o* ?" ^ <td>
% k$ }" f5 J& L0 @* l( v <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">, V4 ^; `/ a4 v/ @8 P: R3 i
</select>5 p) ~% K4 [) p
</td>
2 c4 T% ~! H/ X( a9 B$ e$ S </tr>
+ u( \7 x& o. s9 Q( M4 I <tr class="bgc">
9 ^7 \- B- ]. j" W+ S, A! ?7 m+ i2 i <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>- U5 f! o/ n2 | o
</tr>
1 ~% R3 Y& l: c* ^</table>
4 H! P7 C' t1 q: E1 c; U</form>
" B" n8 j, r8 _! a* }1 t<script language="javascript">2 Y4 K A* C, s/ c* u2 g/ R
//人名移动
0 ^/ p: e1 I( Q& @ _; {$ l$ [function move(fbox, tbox) {
8 B/ W; ?: K. [! O! v* F9 qvar arrfbox = new array();
/ d4 |( e: R3 X: X9 Hvar arrtbox = new array();/ z% R% D' U/ K% |
var arrlookup = new array();4 U2 S# r3 P/ K! s4 W8 c6 g1 Q
var i;1 g1 H0 ~) U$ m5 G
for (i = 0; i < tbox.options.length; i++) {
# a2 h( S" X0 A/ ?; Karrlookup[tbox.options.text] = tbox.options.value;
3 m2 A' G2 Y/ F' `) _8 p2 sarrtbox = tbox.options.text;
" t( F# v5 Z! d+ W- R}
$ D1 M/ [$ U0 {% Y8 a; Uvar flength = 0;: x# C3 R$ V S2 z3 o
var tlength = arrtbox.length;# \* E: w- N4 N) v! i
for(i = 0; i < fbox.options.length; i++) {
1 r7 F9 @, K; Y3 ]: marrlookup[fbox.options.text] = fbox.options.value;1 R! c! s: h# b+ N
if (fbox.options.selected && fbox.options.value != "") {3 |- r0 j, w/ \. X: n3 A9 X) L0 k
arrtbox[tlength] = fbox.options.text;
2 `% `) g, y1 l+ A; t2 Etlength++;
1 m/ J( |. g) Z' g2 Y4 [}
& B5 k# M- Z) uelse {$ Q/ S% w: e" i5 X
arrfbox[flength] = fbox.options.text;$ n$ k7 a3 b3 x8 m
flength++;
% [# Q0 H9 o5 S% T }( p; l& [" [$ W% {
}& a* M q% k [& n
arrfbox.sort();
6 A4 s9 ^* c6 C& X1 barrtbox.sort();
, M5 ^1 @; x# I! }$ S) f# |7 l" j" l l4 {
fbox.length = 0;$ `( H" g& U5 q% }- E5 s
tbox.length = 0;
2 m, s) f- q( F l* Uvar c;0 l7 R p. A9 J2 r
for(c = 0; c < arrfbox.length; c++) {
" e" ]. w% }0 B3 G8 _+ Svar no = new option();
! H' Z) R5 ?# W+ J8 g hno.value = arrlookup[arrfbox[c]];8 v, l ]1 [6 ^4 c( y+ c! J5 P
no.text = arrfbox[c];' k/ o' e- p* i' W
fbox[c] = no;3 x, u, X1 B% H T0 L4 {3 d
}
! L! m( u! c5 S8 d' @& jfor(c = 0; c < arrtbox.length; c++) {
+ E) a- F# T6 Ovar no = new option();: b, _7 K( l6 E
no.value = arrlookup[arrtbox[c]];
6 k$ z& E$ Q, d9 X1 d ano.text = arrtbox[c];
; l* W J8 F) }# Y2 C% a/ f0 Ktbox[c] = no;
$ p: k) k; a& N }
9 U" D; c# e. r" ?}
7 z) S1 I; z4 J0 |9 a" f8 P</script>' n2 p1 g, d. Y: }' d7 W1 p2 ~ n
</body>
9 r! h( L" F3 Y0 e6 |2 ^1 i |
|