|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14421
- 金币
- 2496
- 威望
- 1647
- 贡献
- 1444
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
4 q8 Q! E0 t' ^ c pageencoding="gb2312"
9 s8 j- _, l/ }. {( ]; b%>
# g& s# F5 H8 v5 p0 m6 j<style>/ D4 \; w6 Y5 u2 ^7 _; t
.f9{ font-size:9pt; }1 C% |0 P5 `4 d' r3 G' b* @
.bgc{ background-color:#aecaf9; color: #0033ff }- O6 B2 }; a6 _2 o @
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
& q3 M6 I. W& ?. T7 p; B border-bottom: solid 1px #4e7dc1;
- g' S: A- `4 } border-left: solid 1px #aecaf9;6 m6 B! Q6 \+ I! V0 K1 [
border-right: solid 1px #5679bd;$ ~) y: K! p+ g1 y
padding:1px;1 `/ l% `) e: B2 a3 _6 B/ R
margin:0px;}3 m4 K# i- W1 x7 _+ a7 Z! p
</style>
. O: B& j1 o2 g6 S; n" H7 V<script language="javascript">! _' A- h% k0 h1 J; | L
<!--5 g+ a5 D" V, Z+ `! C. Y
function rv()
1 a* j$ x) p* W9 A6 N9 f{" S" x) d- |/ O
var val="";2 s; g! N1 z& l0 F7 E+ }4 I
for(i=0;i<combo_box.list2.length;i++){
( O9 t# ~. z: A8 L val+=","+combo_box.list2.value;* N- t, b$ ]$ F
}
% X) D; w( u) K, Q e: ~5 O if(val.charat(0)==","){
0 t" W) l* y5 E3 g$ U val=val.substr(1,val.length);
: Y! s$ {$ R+ h. L( B" W) p u }; F( i/ W2 R d& v0 A4 o; y" t
opener.form1.frecname.value=val;5 w' C% w E% e
self.close();3 j1 m/ o3 {0 d F
}
# W! C( I2 T1 A- \$ b1 Q//-->
/ r& z/ V+ W' u; J" }8 F9 g+ w</script>
, P' g: R& Y" Y y/ e; g<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">1 P7 U# s: K2 K( S# l0 ^& r
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />! E0 ~) b" J# e+ \6 V
<%6 v( ~2 v9 u1 g7 a' F6 y
cdatasource ds=new cdatasource(); //数据联结bean实例8 w2 d" x+ N: |7 I1 L+ z
java.sql.connection conn=ds.getconnection();
0 D M* D4 G$ k& @& S" ^ java.sql.statement stmt=null;4 O& [: t, e7 ?$ d$ p# J4 t4 Z; a
java.sql.resultset rs=null;
/ {% y' a9 _1 S: Q cdatacheck dc=new cdatacheck();
# H# R5 V7 U4 ]8 \%>
5 B, k$ }2 Y6 g% G<%
7 ~) D% ^. ` M0 g4 [ Q* X! ystring 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";
P, w' h6 T6 p/ nstmt=conn.createstatement();7 k" Y# x$ Y6 Z* I( \8 y; c
rs=stmt.executequery(sqlu);
3 w5 y4 h* t3 ~# w%>
8 K" K2 t& s h# C h, ^" E<script language='javascript'>' y: f, q3 p( z
arr = new array();3 G) X5 v% R1 }( Z# U6 [
<% int temp=0;# g) B _- h3 H; _0 F8 }& s8 \
while(rs.next())9 L; |6 t& s S( K
{
. h& P+ z, {, r7 b8 c7 m* c2 d%>" e @! o. g' ~- z; a- r" m
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>"); Y2 F5 M( }+ X- N: \" b
<%
0 o% d' r& r- J2 E; p- }& Wtemp = temp + 1;
' O/ N0 v t- H. P/ P: u}2 R& ]/ ]8 _7 f8 z2 R( C
%>4 z' d, \* ~& s" h4 r3 @# T9 X
temp=<%=temp%>;
# x G7 c2 z# p; m7 Nfunction changelocation(id){
8 C4 h) R# i: U* d: U4 ddocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 0 e5 S6 o# c" r$ \8 r% l
var i = 0;
4 R+ S7 g: c: S0 s$ R* @2 K4 Ddocument.combo_box.city.options[0]=new option('-------','');
4 q, L% f/ Q! V m h4 u8 ^0 Jfor(i=0;i<temp;i++){
8 q* y! F, h( U7 U: Z3 F+ Xif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] & `7 H ^" h6 G; `
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); 4 o+ g3 z9 G# B' H( U3 n- \% I
} . n: R* D+ D4 o2 z
}
3 C, I8 g ~: E}
0 V& \/ ]/ j% Y/ H</script>
2 ]) L" |, z5 d& K/ a5 Y0 @, A/ v2 v& I* N. K, \
<form name="combo_box">/ o1 d- M1 w( v/ e' t7 y% ]# C
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">$ u* n: \ v2 U& F" O2 C
<tr height="24">
+ f# N8 T; e& _ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>' P; s9 ]# x, s/ }! @( ^& E
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
: T3 t% O/ H, B. u3 h# P1 ]/ c$ |" x <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>; _- \8 Y# M( }
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>' b- r0 J$ m9 A
</tr>
6 z+ o9 s: [ b <tr>
5 E% O5 D: c: ^& I <td>
) E- F4 S, g1 l9 q- A6 ~0 t <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">7 h6 {! g. H% ~6 Z
<option value="0">请选择部门 ---></option>' S, ~' e$ I+ W' d
<%) u; v& i- Y' r( M* U- U
string sqld="select * from tdept";
2 o) S3 |. E% B9 f% q* vstmt=conn.createstatement();6 B! P6 R5 H7 d1 h8 M \
rs=stmt.executequery(sqld);+ p ~$ p' K C9 B
while(rs.next())
, k1 Q8 Q0 j2 l! s{# ~2 c% `$ _* k, ?) _
%>
7 w. @% i& K6 v <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>1 F2 }' f' _) F2 Y R% l
<%% j+ c) @, W4 f/ `* K
}6 e8 D+ _! c/ c S
%>
$ n/ c! M& g/ p! n( _) {* j0 N% P6 J </select>
. d% y0 U* u; g6 h" a</td>7 t1 R; [' e5 ~* u$ d
<td>
2 G [" E3 u) T( e <select multiple id=city style="width:150;height:200" class="bgc">
$ |7 u4 D* v% o# V </select>
7 \4 `# ?1 ?- V1 }" {4 n7 X" h/ D5 j</td>* s* I5 y/ h. G+ ?5 i/ a
<td nowrap align="center" class="bgc">
k4 E1 |. B6 F <input type="button" value="<<" class="buttons">0 b" m/ ?. i- W$ y+ q8 V6 ]
<input type="button" value=">>" class="buttons">( y5 H1 \; F6 M( x& M7 W$ B6 s
</td>
" w- B" e3 B$ R1 e9 V; @ ^ <td>
% N- N d& i" t6 i. y) T1 b <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">& w: `1 \: z5 p- F
</select>
- M0 W: ?& [0 Y' f7 I% ]</td>* m, E; W4 I$ E9 r
</tr>4 U: }: P3 s) M; S$ ?! L0 e2 S& a
<tr class="bgc"> ' X: Y% l7 h7 @) V/ ?
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
* G( `) ?0 o9 [& J# |" S! e </tr>2 a% F; [/ ~& ?/ A& \
</table>
1 @7 L% c+ e& a</form>" R4 o9 H: G6 O6 L; V% L
<script language="javascript">
+ G Y+ c! O# n! M//人名移动
0 N) ?8 l! Q2 g& N3 G' y) Q/ Rfunction move(fbox, tbox) {% b" X. j0 L/ K5 B9 P
var arrfbox = new array();
: m5 x5 M5 K2 l7 ]var arrtbox = new array();
6 J, `7 }' n" X/ O! Yvar arrlookup = new array();
* ?. e% x8 ~4 ~; }var i;
/ `2 T! x4 B6 b, pfor (i = 0; i < tbox.options.length; i++) {
$ V o1 P9 G3 z% B# G+ xarrlookup[tbox.options.text] = tbox.options.value;! i+ a0 j9 x4 B2 T# E% y, ?2 T
arrtbox = tbox.options.text;: w: t* Y: v% ?
}
" \( i2 D) S6 M3 G; y4 S; Bvar flength = 0;
: [$ o* c* M1 p+ Uvar tlength = arrtbox.length;
4 \9 ?3 R+ ]2 r) g z, Zfor(i = 0; i < fbox.options.length; i++) {
7 ?- `7 \4 S$ c" B! x* J6 K/ ]arrlookup[fbox.options.text] = fbox.options.value;
4 a* j& _# t6 n/ s- e4 zif (fbox.options.selected && fbox.options.value != "") {
; }8 d% q" a1 b/ j6 `arrtbox[tlength] = fbox.options.text;
( |3 g2 V: B2 A, L- n# d! X2 N6 k. xtlength++;% f$ p* R w7 l! t
}
9 l% O9 F; |+ F! Z2 H6 B6 @else {
7 a. K/ m0 R8 L# U5 w) j' ~arrfbox[flength] = fbox.options.text;7 b' y6 g Y. {7 @
flength++;, O" o) i/ r8 r3 \, K
}/ Y4 ^6 R' @: @8 |/ E3 D" p5 Y
}& ^9 f3 ^8 I" h, A& F- `
arrfbox.sort();
- _* S& U! C/ X; harrtbox.sort();2 l: H' x: V' V- W) P2 R
, ?. ]8 Q4 x1 s4 x% G% d2 hfbox.length = 0;
2 u7 n4 q2 O6 Y& U* c, Utbox.length = 0;- Q& {5 F0 t( ~& n2 G6 ] J2 o& o
var c;
2 S3 v) Q# ^) d S lfor(c = 0; c < arrfbox.length; c++) {
( f9 H. y# \5 ^var no = new option();2 y+ n+ w! f3 y# ?
no.value = arrlookup[arrfbox[c]];! j- _4 [6 N* I+ [6 o. Q1 D
no.text = arrfbox[c];" H/ `5 k: N0 v# M D* u- \
fbox[c] = no;
! Y) g+ M! b+ P& f2 O}6 O- i# l# x& ^, _3 a
for(c = 0; c < arrtbox.length; c++) {
5 b, c/ j" v: t5 |8 O# Bvar no = new option();
( K; H! k9 q: k+ Ano.value = arrlookup[arrtbox[c]];! j) a2 s& R, U5 L+ w+ Q7 ~* k. l( ~
no.text = arrtbox[c];* e: W1 O3 M5 N T7 w! ~ [8 M; T
tbox[c] = no;
$ H4 F! s" k4 H1 P( s' u; \/ i* W; Y }
/ e' o; f2 `. W}& a- v+ }+ l3 _& h; U( \
</script>, P* `' S8 T ^3 K( W5 A
</body>
9 ?4 y6 }: T5 X7 y |
|