  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14191
- 金币
- 2386
- 威望
- 1647
- 贡献
- 1334
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
7 d" R3 G' m6 ] [- j6 M2 U c pageencoding="gb2312"
9 C) n4 G8 g, L4 V$ K+ g; ^%>
1 e+ x; p) n3 N9 A! V$ @<style>. Z' X) N6 G% J
.f9{ font-size:9pt; }
6 [7 r' L* Q- h.bgc{ background-color:#aecaf9; color: #0033ff }
: b& \& s0 F9 L3 u- C- J4 W5 L.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;5 G( a4 B' k: t R$ Y" e) | g2 A" n
border-bottom: solid 1px #4e7dc1;
: V' Q0 G& C5 n2 O$ r( @- l border-left: solid 1px #aecaf9;
! H% K2 S9 d: ?% X! w& l. k/ m border-right: solid 1px #5679bd;$ k: } N: q4 T0 d! F5 z
padding:1px;; ~" Z! M/ @% w/ M
margin:0px;}- P. L' E' N, p! h) t' ~
</style> U1 s) V* R9 z) |- D1 i6 ~
<script language="javascript">0 L- Y) N# ^" l+ q5 m
<!--
5 T" _0 [4 b+ z% T7 ]1 \function rv()
+ \. @3 \6 R5 M4 s{/ g# ~8 v0 j$ }0 O( x
var val="";7 b( I# C' { b
for(i=0;i<combo_box.list2.length;i++){
+ U8 ]1 B: X. E7 p) C val+=","+combo_box.list2.value;
, W2 A) N- }3 [5 k }# M5 L8 t$ u" N: c3 [- E2 y4 r- X
if(val.charat(0)==","){0 w4 a* x$ V. H' X0 b
val=val.substr(1,val.length);
7 J2 j. P1 p7 H0 l }
5 X9 U6 l* U6 I& G( H: W; s opener.form1.frecname.value=val;
# h" r1 @8 P1 M! u5 {0 C& c: s self.close();
6 l4 P8 W# @- n. b) D0 p}
- X9 ?7 @6 l- w$ ]0 S//-->
) B) w _6 T, T; K</script>
" O: d% Q2 d- a2 M: n<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">! o; ?. p5 ^! s6 K% _
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />/ o7 J) V5 A: Y1 D' a7 M
<%7 W# G0 T& }$ b5 H
cdatasource ds=new cdatasource(); //数据联结bean实例
' k. `! i! s, \6 ~# `4 p java.sql.connection conn=ds.getconnection();1 S) s0 y5 h/ y/ b
java.sql.statement stmt=null;% P3 U$ H" c9 q
java.sql.resultset rs=null;; K. a2 O. t3 _- l; p5 L5 u
cdatacheck dc=new cdatacheck();. d9 w3 r. B7 I% j
%>5 x+ _5 F9 f- x. F5 c
<%
4 _7 Y+ A# f% sstring 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";
& n. I; Q) K7 q+ Y& k! Sstmt=conn.createstatement();3 c+ y2 a$ o" M+ L
rs=stmt.executequery(sqlu);
7 @9 w+ g0 U6 L, Q9 k1 I/ X%>
1 p% ^- e) m# R. r$ z<script language='javascript'>* C' n6 L7 i& I# }! e
arr = new array();
4 I2 ^3 H! G" x4 U<% int temp=0;8 x! a# f9 Z5 o) j
while(rs.next()); q/ `; ]+ B, v4 p
{ _2 t s& c9 I! p6 ]+ @
%>0 |# w2 i) ]" X- ?: I5 t3 i1 q
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
7 O. D' I+ i! G) w; k<%& `' k8 v5 s6 B$ @( v$ C
temp = temp + 1;
: q0 {2 {* M% \* {6 B}
3 |$ P! }/ C+ n& ^# v%>
) M/ n0 } E9 I0 o7 X$ ?" }0 Stemp=<%=temp%>;( n0 {# d5 g* z+ d$ X
function changelocation(id){
6 u4 b) x0 }* z% Q: M, Bdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 . c; a! O% N+ x5 Y9 ^$ y
var i = 0; - r; V! F5 F; l; z5 i7 O
document.combo_box.city.options[0]=new option('-------',''); 2 m/ F* z& O) u, W" X
for(i=0;i<temp;i++){ 6 ~# N- p" G9 j3 `( s0 g' `6 N
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] 7 H/ D. P1 ]3 d1 r9 H. X
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); % B2 G7 j$ z( H( N: A8 O
} 4 y; w2 V# d0 U# h1 i. p
} ( `3 P' E/ z! ^2 @
}
% b9 g0 F1 A+ r# y6 x% M0 T8 P</script>
4 E2 x3 g8 R. T @. i. X- n% q, b" m% l2 Z+ d
<form name="combo_box">; g. s9 e9 C: G# d5 G
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">1 ]- X" I; Q4 g0 U5 S
<tr height="24">
( o- @1 E% x% E' T9 s4 q0 r$ w <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
6 {; j/ X6 c5 r1 u% M: s <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
" b& ^/ @& P2 ^+ c9 I6 j$ [ <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
% s; K6 G( v9 ~+ w0 |- P* Z! m5 M! u <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>( B/ T0 A, E# I1 U' d
</tr>
2 O! c0 h# Y9 V- L7 U: A <tr>
$ G1 n/ F- _4 k/ P8 A0 b <td>, ~# \; T7 X1 T9 M' L' ^
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">/ p# R/ k! ~ w/ B) l% \0 ?
<option value="0">请选择部门 ---></option>% M* F; |# f$ W2 j8 u0 K& i" I
<%
8 L8 Z. C& Q2 v, U6 t! o) \: O string sqld="select * from tdept";
6 f3 t2 K* o) G# T2 O6 Kstmt=conn.createstatement();, g* U( c$ C6 ^" `" [- w
rs=stmt.executequery(sqld);
9 i1 \6 i7 Q/ n. Q0 t% s' gwhile(rs.next())1 u# i: q2 R( @/ d
{6 W6 M s3 B" \( c! U9 e( }5 d
%>6 f# t" Y- w* u7 v0 Y" u
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
% Z' {& H- v. b5 E( _9 h8 {<%/ T7 A4 m A, p( Z. Y, w7 \
}5 F+ p! f7 Y( d8 W$ u6 E6 h( ^0 Z9 O
%> 1 u8 W; `1 \! `" m% C0 `+ l
</select>
" x2 h# r) L- W</td>
h8 c4 n v; ? <td>1 B7 P% w; b6 K7 H
<select multiple id=city style="width:150;height:200" class="bgc">8 v- K9 g/ k3 h( D: c, ^' g" C
</select>
% l; u9 t' w/ B9 j7 } f</td>9 ?3 D6 I# G7 x! \
<td nowrap align="center" class="bgc">
" m( ?/ j6 t. ~$ O% h. S9 ^+ Y <input type="button" value="<<" class="buttons">
! h5 y- v4 U- C# _0 @$ d <input type="button" value=">>" class="buttons">
9 z' Q q4 V4 `1 w3 f</td>7 a3 Z* e; E2 ] m1 q
<td>1 _1 l6 g; B/ L* D M" [4 p
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
; ?& B8 K3 z- Z* L3 T </select>
! P1 Q. `. W7 s, \</td>
+ P% p/ C R( ]: {, d! t" W( d </tr>
6 f2 ?; \& ? u( C1 ] <tr class="bgc"> 3 [3 ?- e- w D* G
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td># F8 n4 r. {2 k7 _8 B" A) V. A
</tr>+ A7 }/ |. z# g6 s1 ~5 \$ ^0 }
</table>3 |& d$ w3 V/ A0 z
</form>
$ Z2 |3 m( x- v! f K" {* I<script language="javascript">
' F$ K3 h7 j. k//人名移动
) Y2 `: ?- a: u( |5 x' T7 xfunction move(fbox, tbox) {5 C& i+ h$ }/ ?$ ^" m) |
var arrfbox = new array();
0 Z. C. e3 S% L; m6 Ivar arrtbox = new array();
$ o; n& i# |' p6 \ b- F# D6 ?" ivar arrlookup = new array();
F8 R8 H- X9 ^; avar i;& P& s9 c% u3 l+ Q4 f Y9 H; ]
for (i = 0; i < tbox.options.length; i++) {
; w+ O) w3 A1 r# ` farrlookup[tbox.options.text] = tbox.options.value;
7 b v- z0 d! c- D+ Garrtbox = tbox.options.text;; f: C& i9 J+ q5 d
}
* @& Q) }4 B$ _1 Uvar flength = 0;
+ A( S+ k( V4 P& H% fvar tlength = arrtbox.length;
4 Z" E1 z6 V6 \for(i = 0; i < fbox.options.length; i++) {! N1 X9 c5 [& ?5 }' }
arrlookup[fbox.options.text] = fbox.options.value;
! o0 X) h5 |! c. E% y2 d# xif (fbox.options.selected && fbox.options.value != "") {
# d3 k* Y4 c! r2 L( \arrtbox[tlength] = fbox.options.text;$ w& F( b: @: R ]3 j# [0 b
tlength++;
4 X7 K% b [/ }* q7 [: v& X9 ?}
5 R, ~) Z% J; \else {
7 I# A6 C+ z, M; iarrfbox[flength] = fbox.options.text;
8 _. e _. h0 W, l$ V0 O2 l8 }" `- Fflength++;' ~/ G0 D" A/ _' A- y \
}3 b: a. }% ]7 v5 u+ C
}
! R4 U4 c& C7 t) W( u7 xarrfbox.sort();
r8 f; ^- l0 g) }8 [' I marrtbox.sort();
8 f/ G2 D1 S! p( Y) A. e
1 N* \/ y T/ Q' cfbox.length = 0;
! r4 w- X4 ~4 y3 ]6 m& Atbox.length = 0;# [: s! s% Q, _& T L
var c;
: u* V7 Y6 a* B: ~! C4 zfor(c = 0; c < arrfbox.length; c++) {: I" E X+ c! D2 g* G/ F
var no = new option();
2 [8 r9 ^- V" Y1 dno.value = arrlookup[arrfbox[c]];" E9 A* \+ C; N# g) U" ?. p/ f: |, _
no.text = arrfbox[c];4 |) l3 d1 G# L | T+ y
fbox[c] = no;
. `3 E* T/ t( f }1 Y3 _/ t H/ t}
2 Q4 l5 F2 n9 d5 ffor(c = 0; c < arrtbox.length; c++) {+ Z$ w/ H9 D1 Z4 d3 m0 X+ E
var no = new option();+ P3 l' l! l; I9 o, t
no.value = arrlookup[arrtbox[c]];7 ?% c2 w- r* x
no.text = arrtbox[c];
$ F. i0 g, f, Q1 ~+ v# J- _tbox[c] = no;
% R* `6 b9 p$ v- c }3 m$ m3 a, O5 |
}# N6 p* z# c5 s4 N* m: U1 ^
</script>
# v% L3 A D$ o/ N. J# t</body>/ Z. l2 w' g2 [0 h" O0 W/ y
|
|