|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14479
- 金币
- 2525
- 威望
- 1647
- 贡献
- 1473
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
* `& W! P( E& \ j c pageencoding="gb2312"
7 h+ m( k- _9 Y%>6 T$ E) B+ Y& `: M- w. p4 A
<style>
! H _1 n6 g6 }' k8 d.f9{ font-size:9pt; }* I7 U" t# T" v) S5 N
.bgc{ background-color:#aecaf9; color: #0033ff }
- V7 U- @" U: R/ e.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
, Y! i# S6 m/ O; W, @% Q border-bottom: solid 1px #4e7dc1;. K4 s* h1 C9 g
border-left: solid 1px #aecaf9;
S7 D/ ]( g9 V2 s3 z border-right: solid 1px #5679bd;
6 Q' p2 X- O0 y: ~ E padding:1px;
& H$ g, n: p, c* W" w0 G4 h margin:0px;}
3 s \1 B! ]$ d3 j$ r5 Q</style>
8 K9 N, g' m' R& \: J- W<script language="javascript">
, N* {: L/ l# Y8 a" {<!--
8 ~5 i3 }! G9 m# }function rv()
O( l7 m* y6 R! f5 f2 X; h{
" S6 L5 k" E( e& w var val="";
' W# T; X) U1 }8 ~+ Q( s for(i=0;i<combo_box.list2.length;i++){- O4 J4 x9 p/ _( f
val+=","+combo_box.list2.value;
2 x- t% `# D! Q: N8 U! d }
1 A+ q `$ m% Y2 ]% `3 ]) Z: T if(val.charat(0)==","){
d2 [. h7 S9 W! d val=val.substr(1,val.length);
c; C" |" Z' W. a6 o }
( ] V( ^, {1 Z: ]& E+ \. P! D opener.form1.frecname.value=val;6 O8 i( {) F5 F- @& r
self.close();
- b' T: I1 ?. _6 \0 y% a}6 g0 S; m) d# v( g9 F* q+ X' f
//-->
& D- R0 t% _" y3 X. A. Y+ `+ b</script>* D q" f G2 T5 B" `; F* { z3 n
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">% q' c i. N2 P2 h9 M \8 u
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" /># r& {2 q# k- i6 H
<%# u# o# G9 P# ~' t$ p$ N
cdatasource ds=new cdatasource(); //数据联结bean实例
. y. E8 b7 s( N. q' r java.sql.connection conn=ds.getconnection();6 l, ]9 }! Y+ f2 R
java.sql.statement stmt=null;* j) F+ t% E( c4 @# n
java.sql.resultset rs=null;* c# |0 e! n4 `; E' M" }; o
cdatacheck dc=new cdatacheck();
3 V9 k; ~' a% s%>+ [ ~/ c% P4 g% m
<%
8 }1 q7 q% D+ X: `% { b, B, zstring 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";
* U3 {) n; V1 x8 o [stmt=conn.createstatement();( r( x" } g; n7 T
rs=stmt.executequery(sqlu);8 Y* I0 @# z8 [: O! Y
%>- e; ?9 B: C9 ?6 {7 Q
<script language='javascript'>
6 V' {0 o/ l, ?+ Barr = new array();
0 F! c) c+ ^# G6 V9 o* P<% int temp=0;
$ i, Z; z/ k$ J$ Y& n3 [while(rs.next())5 L. A7 B3 u* P& }: P
{
& L! T) g# w1 r( a: F%>
& C3 X5 p" y( @( d7 S6 w% Garr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");. r# }$ R+ }" W2 e* H, l& ~
<%
+ f D# N+ q# y- ]4 o: utemp = temp + 1;# k4 k. P% }6 D1 c. r
}
* K- i/ I% h7 o2 x0 X- Z%>) Q& J* Z3 p- U# a8 A% e/ J# g
temp=<%=temp%>;
! L7 K( C' g, P& r, r5 lfunction changelocation(id){ $ P) V' P! N5 W3 V( z
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
- j$ h4 f7 F1 S! b3 Q3 Pvar i = 0; $ c# H4 ?5 \6 w6 n% m* \
document.combo_box.city.options[0]=new option('-------',''); 3 t* d. K3 Z; H" l$ M
for(i=0;i<temp;i++){
2 @9 P* g4 }: y& Cif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] 8 `9 X; w: O6 ~( H/ k
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); . b+ x0 H) e6 S
} # x6 w8 u x" D @
}
& N' W' _: V; j i; x+ v} 3 a6 D: k+ V7 @( D/ ~9 P0 f
</script>% q+ H9 |- O4 Q4 e# G k8 x. v5 w T
* ~' I+ V) ~1 s* S<form name="combo_box">
0 w. K1 C C; M<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
/ a0 N* A, d6 L/ e. D <tr height="24">
. g+ O6 q6 w. Q$ f8 S <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
- J, f9 A- I1 |. ]! c <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>4 _8 Q9 Q# n9 R0 H9 }/ y
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>! h. O$ U, y$ v0 N6 @
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>6 I; @/ K0 w1 o6 d$ y5 A8 d
</tr>( T9 q |4 Y# _. N+ ^" C
<tr>
( J% `; T' K- O <td>6 s% d- B( v5 H
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">7 l! W" w; ^; d a3 U6 z2 Z
<option value="0">请选择部门 ---></option>9 U! O: ~- c4 b8 U" ?
<% T. E* A2 E% S2 o
string sqld="select * from tdept";9 V; t7 k- X( O4 B$ N* Y
stmt=conn.createstatement();
& g; q7 P5 E1 F$ z5 jrs=stmt.executequery(sqld);
! X" c) G& B* E, ]/ f) ?& Twhile(rs.next()): O8 o, ]1 f: A, O: d _
{
9 G/ R" w4 N4 W0 i%> i9 ~: A" j m2 L
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>! ]- v0 V8 C! J5 i1 F6 x
<%
. J% Q; @, h5 l( W6 {1 E f}
. a: I0 u" j! m# j4 C. D%> ( a5 R& }* t- S3 K) R( L! S
</select>( a3 K6 n) W8 s" n2 F* _+ b
</td>
. e4 n7 z$ q2 E0 h4 d2 x/ ]4 q% H; C <td>
3 C3 n* w7 \8 H3 G <select multiple id=city style="width:150;height:200" class="bgc">
{8 Y3 ]$ @4 X0 u/ I </select>
+ h$ V( B1 a! c0 E( ^/ M</td>
/ P3 Q" E) g* s4 }4 q <td nowrap align="center" class="bgc">% {" ?4 @1 k% v( q7 q
<input type="button" value="<<" class="buttons">& T9 U, e$ _+ \- l7 q/ w. f
<input type="button" value=">>" class="buttons">
# }! [, h, c0 w& D, K$ c</td>
& ~! X4 V I2 N1 g <td>7 K- t8 \0 n- Y4 K
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
5 i$ B' c/ R) [* y# x </select>/ G' y' y, u3 s4 n, T# V8 t
</td>2 j* \2 r+ E, G U- }
</tr>
: f( |; C. W$ N <tr class="bgc"> ! P; i7 L/ L3 d$ J, ]7 |
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
3 ]+ p/ \$ x0 ^% V5 v; W </tr>
7 z* x1 Y6 d* K0 @7 k2 o8 X</table>; a' z# X7 b% w; {4 L/ }( r
</form># m- B2 x5 a& n' `6 q; S
<script language="javascript">
7 U3 t0 t5 u) L, t//人名移动$ e! \; t9 c% G2 ?+ H0 O
function move(fbox, tbox) {
8 z. e5 I) r0 R4 wvar arrfbox = new array();
9 ^9 @7 s; ]# f5 s. f6 Q( j* Fvar arrtbox = new array();
6 U9 t( G3 E4 o) z5 uvar arrlookup = new array(); x" |' D+ B% k9 ^
var i;
Y. T) ~2 q4 r" O+ @6 Ufor (i = 0; i < tbox.options.length; i++) {% R& y0 C. I0 m
arrlookup[tbox.options.text] = tbox.options.value;1 w# m6 F0 _' q. ?
arrtbox = tbox.options.text;. x1 v8 ^, O3 F
}
x0 {$ ?. r, K" ~ r$ lvar flength = 0;
( ]8 C) y+ ^+ Nvar tlength = arrtbox.length;" j4 S, M" N, K3 K. y
for(i = 0; i < fbox.options.length; i++) {2 W" W5 u$ h4 N9 \6 Y, [3 s$ e
arrlookup[fbox.options.text] = fbox.options.value;
, X, ~( B) t: G9 _2 z: [* @if (fbox.options.selected && fbox.options.value != "") {
2 V0 Z5 D( G7 d1 |) ?. I! uarrtbox[tlength] = fbox.options.text;
4 Q% e7 j; |# p0 Otlength++;
0 A. o: ]* E0 F0 a5 G}! _+ S& X$ @* X3 r
else {
; e* ?! V# O* i/ }0 x/ Larrfbox[flength] = fbox.options.text;
1 u0 X; A& D( k- Iflength++;
. m! S. I" \/ G }
3 m+ h2 W4 ]; o}+ I" l* V) l2 J8 }3 W; l
arrfbox.sort();( T+ o! t) Y( [
arrtbox.sort();
2 Q0 |" p# f. K$ H3 Y8 k
7 |5 k! R8 J" _1 w7 M) {fbox.length = 0;
1 S# d; G& e' o1 T1 ?tbox.length = 0;
* Q) T- I% _0 \; P6 w* Nvar c;; W$ p( D. h8 l7 O) H
for(c = 0; c < arrfbox.length; c++) {( L/ H' U% Q* d1 O1 K1 A' J5 T
var no = new option();
% w5 b( N+ L: zno.value = arrlookup[arrfbox[c]];/ O% ~: z' y. ]
no.text = arrfbox[c];$ V4 U3 k: ^# b3 ~2 p; P4 z* ^, O! j) C
fbox[c] = no;
- P* w% l( |5 U: o# D9 l. L}3 r. j: A) Q4 J3 e. n# x3 E
for(c = 0; c < arrtbox.length; c++) {9 h( s/ j" H# ~2 U2 D
var no = new option();
8 m+ W: n* ^) Hno.value = arrlookup[arrtbox[c]];6 x1 z% B2 B; C9 |4 Y
no.text = arrtbox[c];
9 q6 y- F/ K- f$ stbox[c] = no;
4 l2 |9 l0 d8 x; F/ P8 a! Q }. \$ C9 C' B) N, L
} c/ h4 U; G$ Q
</script>. h; c5 ?8 |; w p9 e" `
</body>$ M3 B% f+ e5 W
|
|