  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14161
- 金币
- 2371
- 威望
- 1647
- 贡献
- 1319
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"$ m; g3 L. p1 m) M) G; Z, C
c pageencoding="gb2312"
n. s9 c: p) D2 e5 }+ v# k5 h%>
8 Q/ h) o. k# h9 \8 b- s: j+ d<style>4 _7 G& P/ k- ^5 `5 \6 O
.f9{ font-size:9pt; }8 M1 f2 e) K3 L. `5 J
.bgc{ background-color:#aecaf9; color: #0033ff }1 x `3 b; \# r. ?# U7 E. y' k
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;5 _/ Q) K6 v- E- ~# i
border-bottom: solid 1px #4e7dc1;9 ?; X. K7 m1 [) t! K
border-left: solid 1px #aecaf9;7 f4 v6 b3 P. \% \9 i
border-right: solid 1px #5679bd;' Y8 g1 x* H! I) c
padding:1px;
3 [# j% E ^1 _' p margin:0px;}0 a1 K+ v/ D) U) Q
</style>2 x: A: i; V+ r0 c) e2 M: l
<script language="javascript">/ C+ h: E) f2 @# E; I
<!--
( j& H" X: ?: J1 l E5 Hfunction rv()
9 V5 o( q8 u* ^# P- t{+ y b. B; b* u7 k
var val="";2 q. e; @7 C/ A- F6 H$ |
for(i=0;i<combo_box.list2.length;i++){
+ }5 q T) p" H4 H" _ val+=","+combo_box.list2.value;
! r( q% S7 J4 S }6 X; u# ^1 Y. c! [* E' z
if(val.charat(0)==","){
M2 k! M! \" M4 @4 e1 f$ H val=val.substr(1,val.length);% t0 w* u2 f+ X; ]" Y) z" M, Z
}' K+ Z7 ^8 D1 L7 i* O2 m1 G1 J6 ~
opener.form1.frecname.value=val;
, h! `- R) L/ `' s: o self.close();
4 L, u2 i% Z: D" M, n}
0 V) s$ _7 T9 S# W3 z) w5 U//-->$ `% w; R- Y. P. m O( d
</script>
) b' z& L5 o2 L' x7 z<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">( v, z6 h; Q% q3 q
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
, j5 d1 a2 K! r+ `) X: m, M<%
% G* ]5 L. G) I2 p: [4 j+ k) K cdatasource ds=new cdatasource(); //数据联结bean实例
1 v6 d. h+ k! E- G java.sql.connection conn=ds.getconnection();5 F$ @; P I, g# S3 E
java.sql.statement stmt=null;
7 n4 T& m+ m( U) H6 x java.sql.resultset rs=null;; \+ Q3 W' T7 s' @
cdatacheck dc=new cdatacheck();. m6 m8 `) x( v5 C3 N, z0 b5 A
%>
; M6 o# l4 N9 }! M& \1 a<%. e0 X k4 A X( D
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";3 ^# p, g$ H2 Z+ j1 n' `
stmt=conn.createstatement();' R/ D4 \" v5 J( V3 v- H0 x
rs=stmt.executequery(sqlu);
" X- O! v6 S# U9 G8 }' ]9 S%>- ^% R0 A. b8 K+ F
<script language='javascript'>
# [8 H* A! L' Z7 t/ Y0 i" yarr = new array();7 Y; I. a8 y0 v3 A+ L W
<% int temp=0;
; R1 e4 H0 M" |& Q- b( z- p$ y1 F6 y iwhile(rs.next())
_: u* j' t' P$ m6 K. P R4 X& B{2 i1 m) L8 G6 b' N+ g
%>8 m) F* k7 s C0 c' e
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");9 g9 ]% K3 i3 g
<%
6 x! d# e& n# P j8 a! }temp = temp + 1;
/ `7 D7 x$ f, A3 d) ~ J}
' P1 |; |/ |: |) H. P%>* R$ x) K+ F( o5 m& P9 @- x. y
temp=<%=temp%>;
# q. Q& E8 [" gfunction changelocation(id){ 9 T, \ ~2 Y* L5 s' Q# M2 w
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 ! }2 L7 }; ]+ P
var i = 0;
) X1 j: C7 b" M( I& ]document.combo_box.city.options[0]=new option('-------',''); V N* t; Z% C- u1 [' `
for(i=0;i<temp;i++){ * [3 `7 M8 u( Q% K: B V% W' V
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] ( g$ `! M" K2 S- o
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
: ]' r4 d5 |5 A2 ^" a& r} - b# d$ ?' y1 W+ K* D
}
8 O- P8 t7 [& f; r}
" Y4 n ]) f/ a3 s</script>* U& u7 W, c1 q1 t) c' R
# y) @! b: {! i7 R; z# z" s" y<form name="combo_box">
" f3 p! J4 M! x; ^/ G2 ?4 F<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
9 r: {# r/ w' v/ H5 R% q1 Y <tr height="24">2 x |% L" d6 d3 ], F% R0 d" m% d! J2 L
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>; Q3 p) G% h- H% e
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>7 ]1 `+ i3 w( x4 R( @& |# b
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>1 j8 e! D/ b7 k2 D" _3 Y, G- W
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>9 e% j+ i& T8 G
</tr>
& Q# A* j& o6 M- w5 K% {6 w" N <tr>
; l& a+ D7 @) J) V <td>
7 h1 r- I s. S; X9 @: o <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
' }, c" T1 {0 h" G+ D/ v# K <option value="0">请选择部门 ---></option>
1 L% q8 @9 t( t<%% V0 Q5 e9 v& } \) E& r' R" w" U
string sqld="select * from tdept";5 Q. j, o2 l7 _" \4 C
stmt=conn.createstatement();- }% c2 y9 k! m+ C4 Y4 r" n" T
rs=stmt.executequery(sqld);( ? {- `. y* q; s! c7 O% u& z
while(rs.next())
6 e3 p i- E/ R{7 p$ |1 x( H) a0 @: w' Q0 t
%>
% d. N+ H$ e" M" a& c+ c/ V <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>* D U* U! H# b. X/ [
<%! K7 o& f" b. s' B% b# F
}3 V% V/ ?! D& C2 ]2 d
%> 0 m8 u% t/ e, p1 w# B
</select>8 X" G. s* G u7 l6 O+ N
</td>$ `$ j" D7 X: a$ P
<td>0 a" \7 H( n6 k% U/ G
<select multiple id=city style="width:150;height:200" class="bgc">
# O! }" b( y! N0 |+ f! M </select>. f9 v o- B' R+ G6 H
</td>
1 C2 V3 ~0 W6 K% M: n+ X; o <td nowrap align="center" class="bgc"> F. i- ]2 y6 L" z! a, v' O
<input type="button" value="<<" class="buttons">. k# s9 g+ T* C5 J3 B6 P9 y* _; P
<input type="button" value=">>" class="buttons">9 y: c4 s8 w# H9 C5 j; }
</td>9 n2 f( W% }5 r7 S# |1 R4 _+ {: Q
<td>! V' Q6 F& y4 [+ m! `$ V; c7 Y
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
& ^% n! r! M& Q) r </select>" O$ Y) }1 _2 g; q: K( O; i5 A) V: a
</td>
2 X7 S# d# E' e: L Z1 @ </tr>' O) V. p9 w1 f5 Y8 a Z5 f' [. x
<tr class="bgc">
5 ] X% \, z6 V( z* d' g9 i <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>9 N( V6 K/ D* U Y0 c
</tr>* E5 d$ d- D! u% B8 V% a
</table>
7 }$ x: m8 e' N# I2 b- _</form>, w3 R+ G1 m0 ?1 D- J
<script language="javascript">. z9 Q& X, x$ C, b
//人名移动0 W( r A! n2 T& b, P5 P
function move(fbox, tbox) {5 B' A% d+ t# n6 x6 r7 p
var arrfbox = new array();2 e; R9 O% M% x' m( m: r
var arrtbox = new array();% r5 j4 m' e/ J. c( m* @
var arrlookup = new array();
1 e' Z2 E4 n1 [0 H9 o. |7 N: Z# Hvar i;
# p" Z! S' E8 F8 J( k2 H# @+ qfor (i = 0; i < tbox.options.length; i++) {
3 a- v: \' [- u, E: Varrlookup[tbox.options.text] = tbox.options.value;
# X+ O* }$ |7 r* ^0 g- Z: qarrtbox = tbox.options.text;
, @" p- Z3 p2 f! \}
/ T& b& e0 r) H7 c" ^5 Uvar flength = 0;+ Q9 B0 x1 H) Z& e- P( n" ^5 w y
var tlength = arrtbox.length;$ G: `! r2 L7 i" Q* K
for(i = 0; i < fbox.options.length; i++) {
; k- p( A# m6 U! j; ^arrlookup[fbox.options.text] = fbox.options.value;' B4 Z; l3 T- K6 P( c4 ]
if (fbox.options.selected && fbox.options.value != "") {( T2 v3 y5 P& H h: a, O
arrtbox[tlength] = fbox.options.text;
1 J; x: s+ a, z4 l) k+ Ntlength++;2 F: F1 {: I( c' [: w7 U5 A
} J) V5 v5 H, x w5 V3 b0 E
else {9 u1 F" x. }+ D. r; r
arrfbox[flength] = fbox.options.text;8 N, h9 q: T7 Z, S, K* r4 p
flength++;3 `8 l4 ^& ]) l* _9 `
}6 S) Q/ W, r! B" c: L0 @
}
1 k7 X% [% w( Qarrfbox.sort();2 K1 o- |* l! c; W
arrtbox.sort();* L5 x. J6 E$ V7 T& h" b: ?, p
# s" f" \$ F( g# G
fbox.length = 0;4 q. l' H: A+ G; l( ~0 H! y
tbox.length = 0;
4 `1 {, t' |1 g1 uvar c;9 |$ w* c8 s* g& L! g+ M5 v
for(c = 0; c < arrfbox.length; c++) {
# R7 q+ G: c) E- L- w; q* [var no = new option();1 c5 R8 i8 W$ H' |" ^ P
no.value = arrlookup[arrfbox[c]];
+ Q0 U/ D% K7 G& ?! zno.text = arrfbox[c];, v- j. n5 `! Z$ t; F6 g0 O
fbox[c] = no;8 p0 P" Y* w8 h# m
}
# d) K4 ^ \% s; H3 a, B+ afor(c = 0; c < arrtbox.length; c++) {6 W+ K u8 N. A1 L9 f) M" O
var no = new option();
6 N. J3 G+ \. c7 T; Y) @7 wno.value = arrlookup[arrtbox[c]];
7 h" |: ?! E1 r1 z* y+ yno.text = arrtbox[c];3 U$ z4 x7 M$ E, E2 p, {8 P
tbox[c] = no;
3 z' r: o0 @/ H+ z ? }
4 V+ g) T4 _; S! A( V}
/ `& i& c4 v8 D7 b' e' Q</script>
" K( k% e, S5 N7 E+ g' p</body>+ r8 E, P7 R+ D8 B& }# l
|
|