|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14389
- 金币
- 2480
- 威望
- 1647
- 贡献
- 1428
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
( F) g" }' R5 W! a c pageencoding="gb2312"
+ P0 A3 L# K3 m c; |4 j5 O%>" N# H: f8 D' x- Z' {8 c8 i# Q N
<style>
' T$ N2 J, G+ H, C! V+ \6 F.f9{ font-size:9pt; }
/ v l8 ^. a1 K9 d.bgc{ background-color:#aecaf9; color: #0033ff }' r& [% J- C$ b
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
6 O# o1 P* ]( y6 d2 K( |/ V: P2 \3 { border-bottom: solid 1px #4e7dc1;1 _ c2 C: L7 H. F
border-left: solid 1px #aecaf9;
# L6 ]; D$ h! L) W+ [ border-right: solid 1px #5679bd;0 S& X$ v" h; F6 M4 F
padding:1px;* b7 [4 u" n2 V" }* a r! ~2 E
margin:0px;}
/ N, ^+ A4 R0 v, X% h& |9 ?</style>
. W9 o4 e6 s, D0 m<script language="javascript">+ r! M* j$ h7 ?& {( Q
<!--0 c! o8 f3 V# i& K" }5 V
function rv()
- N( X0 \! F$ p: c4 [" l5 ]{
! D$ ~( _# W+ c- } var val="";: p( e+ e5 ]9 X1 {/ V
for(i=0;i<combo_box.list2.length;i++){6 n: W# {) W, l0 @3 \! X
val+=","+combo_box.list2.value;! E+ [& `/ `/ E. B
}+ a. _8 _- N2 T( `8 X6 V' H
if(val.charat(0)==","){/ E3 r. Y2 s6 x8 d6 {2 x7 Q1 P. [
val=val.substr(1,val.length);: B" x; J+ X$ I7 r
}
7 [$ \$ i9 W6 V9 _ opener.form1.frecname.value=val;
7 \ p& l5 Z( y7 J self.close();
1 b b% \ p+ c# [3 w' {- h}
- S u4 t) q, r; _' {//-->
( V2 }0 {; ^& j6 I% v8 l</script>
n3 x; n4 i; I% [<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
7 ~$ Q* F( W3 S3 T+ ?<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
8 k4 `6 ~4 U2 K- A# P3 ]<%) }3 Q2 I) }4 W4 h: P# _' @
cdatasource ds=new cdatasource(); //数据联结bean实例5 W% `& V; x# |" t4 M: H* [+ p2 R; z
java.sql.connection conn=ds.getconnection();
' f1 G5 w2 O, X* L9 H/ ] java.sql.statement stmt=null;& I* ?% H0 s, C% O$ a# Q
java.sql.resultset rs=null;* K$ s# W* w+ l8 I
cdatacheck dc=new cdatacheck();
, S% C( ^9 u3 _& o%># n; A! S# V4 ~. n5 G+ w
<%
) f4 i/ z6 {2 K8 D( A) ^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";8 f: t$ [8 q; X5 T2 P+ n5 Q
stmt=conn.createstatement();
: m' n8 ~; p- \) O5 `: F' F7 _4 Grs=stmt.executequery(sqlu);, T0 P" T. Y; T$ A9 |
%>
+ t- h1 p2 |& d7 j# S, u# T; k<script language='javascript'>0 d; L" R8 n% b" L, I L2 D! {
arr = new array();
4 B# ^/ p& ?* q: _. m<% int temp=0;
& ~$ i8 J6 q6 d" xwhile(rs.next())
* g; X9 J( U0 [! Y4 d" v! ]{
. u9 p$ x( U# _9 ?. K2 \5 y2 ~( J%>
8 K; ~9 a8 r. [. f+ ^arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");' {5 v1 r. S$ K! I ?
<%' a" C4 K6 {% [0 T6 p' ?, c
temp = temp + 1;
1 b6 P" |! W' j0 C, ^8 Z' U}" J, B* X: ~$ o7 n: w, e! a
%>
' V2 _' U' I, |! @. Ctemp=<%=temp%>;
; r+ N' f: K' z6 n0 n8 {function changelocation(id){
4 ^; a8 g2 ^0 _4 \5 ldocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 ; _# z; O1 u! }& z' p+ I7 n
var i = 0; 7 z, D0 d! {9 l# X% _
document.combo_box.city.options[0]=new option('-------',''); + s" }4 x9 i# g. l! t6 N0 Y& R
for(i=0;i<temp;i++){
" l: q" m7 t/ r0 e, t n1 u+ {if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
& M4 `# E( e o! ]8 w7 h, Gdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
+ {: v2 H6 J3 p* n5 g: U% g6 n}
& O+ ~- g1 C( f( {}
y7 ?* I: W- x' ]: h}
5 y: {% h6 `. X7 Q0 T/ a% V</script>8 @+ l0 O0 a8 R$ T! C/ b+ j
! v' C/ d# n, S$ X6 F8 Z
<form name="combo_box">! E5 o8 p% }, m+ i* T" C7 J4 E9 z
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
c# {% S. ]; b2 y- ~ <tr height="24">6 @: N( I1 w3 J' a$ s6 K
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
4 S0 K k' z; b- Y# @ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
v4 l0 C! v1 s9 ?3 J <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
5 }# a3 @ X" R( d' u3 W <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>- `. h" d( D- ~5 t2 r* [5 ?
</tr>, n! G: Y/ r' \- p. G
<tr>
3 W1 |8 c" @/ Q. Q* h: q <td>; n" S1 U6 t6 N( `- k
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">* h' h6 e, i8 g" F. g7 }/ e q
<option value="0">请选择部门 ---></option>
( M* P# L* l3 Y- @8 @: \6 u$ g+ {+ u<%) d7 N+ N" D% M# L+ L' o: P r
string sqld="select * from tdept";' e" S+ w# T1 q
stmt=conn.createstatement();
: O( h" }' i5 K1 U# [5 qrs=stmt.executequery(sqld);
7 o# L4 M- l1 dwhile(rs.next())
4 B: y: f1 R1 ~9 }( z7 ^* A{/ P n3 I4 L9 N2 a5 b! S: W8 _; B9 }
%>4 m! C) C. P. b% g; ?0 q% M9 h2 l
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>! E+ E) y7 `# I: f! `
<%
6 s, `5 f" L3 Q" V}# y' F' d- T8 A3 C& Q
%>
; c1 V! o$ w, y; U9 l </select>5 W# H7 g/ Z7 x: r2 L$ h
</td>! C( p4 y/ G0 y
<td>3 Y# }' u9 ~1 T% W
<select multiple id=city style="width:150;height:200" class="bgc">
# @( y& T* S; m </select>% _1 Y7 D; ~! q# o
</td>6 p- w/ A# ~4 w8 O$ x; T
<td nowrap align="center" class="bgc">& ]4 V* e2 B$ i4 w) }) }* j" h
<input type="button" value="<<" class="buttons">2 X: \( h1 e7 j3 @
<input type="button" value=">>" class="buttons">! i, ~6 v% N$ T& |
</td>
2 Z5 |8 }8 R# @2 y$ T <td>/ B. j) i; E& B2 R* ?; z5 o3 @
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">! q4 h& y% O' R# P
</select>
2 `' V' \; ]- i6 j$ j5 s</td>
' F- M/ v; J( e: k </tr>
6 ~+ r) `) s( j4 c, w7 U% K3 W <tr class="bgc">
" Q2 U, o7 E5 r. X% h <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
7 Q- r& d! E2 N( `) [ </tr>
8 ~5 m+ P; @0 i5 J4 H9 R( k7 i</table>% K _8 u2 ?, n. V
</form>
; H% A% ?% K x S% n<script language="javascript">, s4 I4 ~% [# s# w
//人名移动
# {9 M# }2 Q4 jfunction move(fbox, tbox) {
, y& e, ?5 w5 a. C- Dvar arrfbox = new array();: X- A( I+ D) D/ i
var arrtbox = new array();4 `) \, t2 f1 V8 g) o/ f
var arrlookup = new array();
+ I6 h3 t C: \: `8 _& o) _var i;+ s* n! ?1 n: _+ ]8 W$ K1 W8 J
for (i = 0; i < tbox.options.length; i++) {
3 H) [3 b( }5 a$ N2 E; _/ d- Yarrlookup[tbox.options.text] = tbox.options.value;1 t5 M, ^) G5 l! Q3 t
arrtbox = tbox.options.text;- \) u& w/ h5 @, ?; ^! g' n; w6 F! ?9 A
}7 z+ g) b& [6 Q2 L# }
var flength = 0;* h2 N- D8 Z$ O) M' ^% e7 t
var tlength = arrtbox.length;
]+ U* b, G$ b% Mfor(i = 0; i < fbox.options.length; i++) {
5 Z. @ [2 L, }4 qarrlookup[fbox.options.text] = fbox.options.value;
! |3 C4 C8 t6 N" w6 D! jif (fbox.options.selected && fbox.options.value != "") {
1 n m6 t) z( M" n- Barrtbox[tlength] = fbox.options.text;
. a3 {/ t' f/ g: R5 W' z' @& Btlength++;) E% E8 E5 C1 s# ?7 M2 i# t0 U! X
}
. B" w. _; V2 p3 W8 I5 C2 W: G* Gelse {
6 _. r* G* J: rarrfbox[flength] = fbox.options.text;. Y8 K' w% Z& A* t- Z( Q- T
flength++;
! G7 U4 v( H M, \) U i0 e }; V6 ?+ }5 u6 @; n
}* y2 R4 A6 ]1 q* m/ [
arrfbox.sort();: W0 b, z! ^- p
arrtbox.sort();
% i4 Q1 S# `. O; v6 J0 d! o; I, m+ x, ?% R# E
fbox.length = 0;
2 N( U6 |" B( @# h# X( K7 z& Ztbox.length = 0;7 k. N. z3 }% q% ~
var c;
( W I- T: o& m( f9 j4 k8 efor(c = 0; c < arrfbox.length; c++) {! L! |1 P9 M) _. p7 r6 F; ^/ C
var no = new option();, R$ t+ C! R8 B s* l" i: j8 W0 Q
no.value = arrlookup[arrfbox[c]];
; b: C/ S) s: s" tno.text = arrfbox[c];) [- U: M) G/ a) l' F
fbox[c] = no;
! Y8 x% a9 C* d H( A! k}# i# @& F+ |' ^4 }3 U
for(c = 0; c < arrtbox.length; c++) {
6 H4 ], m7 U. Mvar no = new option();( [8 H; }1 V: f* R, c7 f; A+ S/ n
no.value = arrlookup[arrtbox[c]];, w: ]; J" [1 W7 W% S7 \
no.text = arrtbox[c]; \6 N: o1 Z! M% P1 {) p1 g- ~! T
tbox[c] = no;, X. Q0 d4 l1 m E8 m
}) [& O: v* G( E8 K/ F( W
}" @) r' r$ Q9 g& T
</script>; B. @" k& S) G+ H6 s1 l
</body>
: u1 Y) K( v" x/ m5 N' ?( P |
|