|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14403
- 金币
- 2487
- 威望
- 1647
- 贡献
- 1435
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"2 F! Z. R' \$ K, G
c pageencoding="gb2312"& m, ^4 S# O; h- y4 [
%>4 f4 G2 Y' Z0 q
<style>$ X2 x6 p1 d, R; E7 A: y
.f9{ font-size:9pt; }* g3 e: z Q% k
.bgc{ background-color:#aecaf9; color: #0033ff }( q( o+ V6 i- {
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
3 }. N1 P4 D2 ]' ?2 e3 S border-bottom: solid 1px #4e7dc1;8 N7 d" q7 A' A* Q b( G
border-left: solid 1px #aecaf9;: v9 `6 j- U, I7 a
border-right: solid 1px #5679bd;( }9 e9 u* [3 A" A" {4 G2 K
padding:1px;; j2 ?/ p# d. s% ^! m1 D
margin:0px;}( ~; V ?9 k O4 Y
</style>; j1 l5 f/ l0 c( [8 h
<script language="javascript">% |& Z% j" v* Z% ?
<!--
- n5 ?+ S u. _3 F( ~( Q" nfunction rv()
9 n! T8 H I( K4 ?0 }{+ b4 T% S& d" L8 J
var val="";
( ~. K1 Q! v- T; U: V$ O for(i=0;i<combo_box.list2.length;i++){" @& G; h1 L$ V
val+=","+combo_box.list2.value;
% g$ ?$ u# m ~ }
# I8 T4 w9 w1 K1 D- y if(val.charat(0)==","){
: m8 S }1 D$ a1 a5 J9 _# ]5 s3 I val=val.substr(1,val.length);
+ a% e) B5 f, t }
6 z7 q' y" b+ U0 P y opener.form1.frecname.value=val;3 b5 G! M" f' N9 V, S
self.close();$ \- M$ n8 q: \1 S
}
, Y+ L* l+ K0 E//-->
" Z& I0 {. M( \, U</script>
7 V$ Q) E6 m' E% v/ c z9 k! t<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
8 U, G6 L- [7 E<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
7 M) q3 U5 u: Y0 O- _# a<%
* K6 U8 x! H# F' F2 [* c. ?, k cdatasource ds=new cdatasource(); //数据联结bean实例
+ i" n8 K3 E$ o. _3 M java.sql.connection conn=ds.getconnection();* [' R5 W" Y$ g5 h0 L
java.sql.statement stmt=null;2 a, R+ b0 I* m. v* P
java.sql.resultset rs=null;# ?* x; V, N1 |" V' G% h0 ~
cdatacheck dc=new cdatacheck();
# T3 a( g) r, h" k& V `: N8 K%>
2 k* o- j! ^, @* ^3 x0 R<%
6 e1 w; q/ a0 c" u4 G P7 ]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";1 v0 g- N! }. F6 V; j
stmt=conn.createstatement();1 t) c6 {3 ?/ r9 I% O. `# N
rs=stmt.executequery(sqlu);
9 B! m$ I- _& ^9 @+ R0 }# K( S# g) X%>- {) s3 ]# ?8 t6 |7 @5 h
<script language='javascript'>
% J3 L! }# f, h; W- p5 g# B9 T$ tarr = new array();- J2 Z$ ?) p8 o/ L2 I7 ?
<% int temp=0;, \( T& Z. \4 @8 v2 p
while(rs.next())
& {* w8 ^- B+ n- q{
1 P; L1 }; J5 g- r%>. d. W5 C# `: \8 B# u& B
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");! y6 O2 t* e% P: U
<%
; D% I) @* L1 |7 g- Ytemp = temp + 1;
* J0 c7 |4 o. h2 X8 m}
( S. \# U# o* t%>
2 n7 g% k/ M, q n! @temp=<%=temp%>;
& b1 Q8 ?+ _" E Qfunction changelocation(id){ % j! p4 ~, B+ w
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
6 i; D% T( F! L0 D6 ^# uvar i = 0; $ M- q! [' _& S* W4 G+ I
document.combo_box.city.options[0]=new option('-------','');
! o* M7 {/ q9 ofor(i=0;i<temp;i++){
3 _5 e( A- ~' {( ^0 j+ hif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
3 T: K7 G6 r9 s$ h+ xdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); \' k2 w# {8 `
} " z& U# T A* ]9 R
} + ?. _5 o# v& z1 O! C& j$ g
}
8 C% t% u7 B _" \</script>
: n j: Y s% u) H* U0 ?$ ?( P
' T% y. z; n9 ~ S# n0 z<form name="combo_box">
: {5 x* [0 Z6 a t<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
: _# a! S( V9 v# ?5 i" S! p4 M <tr height="24">% R% W7 O) c1 t" \3 _. U9 @- r
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
# b. w$ _* ?+ w# J1 v" s) x <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>* T; b% D* ]& I2 c) X, P$ `1 U
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>4 Y1 m2 n" U/ D- W/ {. ~
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td># L& z* R; y# n5 j: q
</tr>
, K5 X8 K/ j/ \ <tr>
# C: L _0 V. P2 R4 ^$ ], d <td>
6 N5 k% M9 h0 D0 d; x <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">3 b0 ^$ X3 L" e, G6 l
<option value="0">请选择部门 ---></option>& `& O: S3 j! \& [& E& {, ^
<%0 D3 R, z* D- h2 u1 _' U& ]5 x
string sqld="select * from tdept";
- t, W/ W5 W3 o9 M" V4 _) M% Dstmt=conn.createstatement();' e' E9 V. I* j2 B `2 A6 l w
rs=stmt.executequery(sqld);
1 S6 R& C3 T5 B8 Gwhile(rs.next())* ^& p: R3 M8 a7 p
{
) w& s4 A4 C. e# N1 A# ?%>
3 D4 i1 r: y, y1 W7 I <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>! a4 s6 Z4 G) s4 t) M
<%- y9 u( a6 J9 `4 p
}
% x# q$ M; G3 O+ z& b%> + b" n$ N1 a, c
</select>$ E5 O; e7 n# R9 q
</td>
+ v. P5 z2 O4 l3 t* H <td>
T+ d" }" H) p6 y" N4 H2 T* g <select multiple id=city style="width:150;height:200" class="bgc">
/ @1 a: n- @! h* K </select>7 \* X9 l& _. ^ T$ ?
</td># R' T9 M& `: P8 m& Z( U+ t' x
<td nowrap align="center" class="bgc">
$ @& m3 ^1 w1 n+ i& u' ^0 m9 d <input type="button" value="<<" class="buttons">
- V0 L! s {+ P* {7 ~* r0 f- B <input type="button" value=">>" class="buttons">, S. f, W8 Z. C* i& A
</td>
R9 a5 O4 ~' Y! g! H% z <td>8 O, l- E: p- t! u
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
1 K+ l: e8 _! I* X1 Z, n/ i! O' ^ </select>
( x e$ K7 T+ \, w C</td>
2 d" \8 Z7 {1 m6 K </tr>+ L0 f! F1 ~3 E6 ?! e
<tr class="bgc">
- m4 M" ?2 j f7 ]9 r <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>( b6 x; V. `+ y+ S1 Y
</tr>
6 p4 {5 m2 B; F: |1 K; J) u</table>
5 @8 e& U% F* g</form>
* x7 [: M' |7 D<script language="javascript">
6 s8 x* N$ |2 c4 n6 X1 N$ U" @//人名移动- Y* `7 |, K' N
function move(fbox, tbox) {0 e; Y# L3 f7 h# K0 u
var arrfbox = new array();1 W# w$ |8 v2 u8 E' J) O& Q
var arrtbox = new array();
( D! i* K8 h- X% Y5 f m S, tvar arrlookup = new array();
, T" B0 A4 C: M* G: q0 ^var i;
, m+ g# g7 P) o+ G% f2 I0 xfor (i = 0; i < tbox.options.length; i++) {
; J5 k" h6 s5 n& {* w( b- [* u4 ]arrlookup[tbox.options.text] = tbox.options.value;
2 h) X; c6 p+ ~9 B& }& a, Yarrtbox = tbox.options.text;
! A8 U2 a/ h6 K4 ?# ?}
: P6 _5 Q, y' J7 e6 F; w F1 ?var flength = 0;% Q6 `8 |: u2 r* |1 `' P5 f
var tlength = arrtbox.length;. u9 X j: i# y
for(i = 0; i < fbox.options.length; i++) {+ {6 S2 w+ c- c
arrlookup[fbox.options.text] = fbox.options.value;
9 F- _: \; C0 V* }% [% aif (fbox.options.selected && fbox.options.value != "") {: ]( t7 e, `3 x: j9 Z# K
arrtbox[tlength] = fbox.options.text;
! c7 @/ O1 F itlength++;
( Y f- C6 B. t% J' \9 s3 r z2 ^* Q}
( z& `/ H, I% q9 m8 t9 j9 a8 Oelse {
* O, I5 [$ b0 W# y$ Narrfbox[flength] = fbox.options.text;" s) J$ M: k3 R t
flength++;, |% }9 c0 ]0 }/ p7 i4 W
}
% b5 O! n; V: I$ [/ w4 O2 ^} p. U! S9 L8 |
arrfbox.sort();
6 n, c3 d0 p) T7 H. c, c/ m" }& aarrtbox.sort();8 A8 u! H M$ I2 e% V1 U
1 V) J% U7 v J' V0 @
fbox.length = 0;- a2 S8 ~7 O; @
tbox.length = 0;- R) A5 b: Q. W# A
var c;
+ k8 [+ r0 L. j" \! Gfor(c = 0; c < arrfbox.length; c++) {
) q1 L9 ?, n$ U. ?" Mvar no = new option();- }( _0 p9 h* O# r' L! _$ s( }' R
no.value = arrlookup[arrfbox[c]];
6 G4 a3 x4 z; j c- _% u, X3 Fno.text = arrfbox[c];( E' h. r9 t, w4 B4 I
fbox[c] = no;
2 C% m9 y% }4 O}& {2 O) n j8 ?+ ?5 f
for(c = 0; c < arrtbox.length; c++) {0 w4 s; V# X- N# h0 ?
var no = new option();
2 w4 }$ {. Q2 @1 Vno.value = arrlookup[arrtbox[c]];- w% c5 f4 X+ S' B5 z
no.text = arrtbox[c];
3 z* s7 X' R& j; l4 v2 d, V: o! Ztbox[c] = no;4 n& v( h! }- T* L' {3 f
}
% Y+ {7 y+ t. l$ N* h; d}5 k+ M! E6 l- k2 Z& _
</script>
* K5 q6 N! s1 i' |9 v1 E! \ j</body>- B4 S% z _9 K+ x4 ]7 s4 o
|
|