|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14433
- 金币
- 2502
- 威望
- 1647
- 贡献
- 1450
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
& H, H, z1 f6 \( G1 t/ l* ` c pageencoding="gb2312") Y* b1 d- s0 O8 `) s$ N y+ ?+ i3 a
%>* {, w+ x' s& j9 a1 g
<style>* j' i% _7 x( V, \& R0 c
.f9{ font-size:9pt; }3 A' h5 \4 G3 V
.bgc{ background-color:#aecaf9; color: #0033ff }# M ^7 K- ]- M& h' j! d' `2 h
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;: Q' o/ b& N; `2 Y; n
border-bottom: solid 1px #4e7dc1; x. @8 x1 t9 }) y
border-left: solid 1px #aecaf9;, T" k6 G; W( N( |+ Z- w
border-right: solid 1px #5679bd;
. L9 O2 A5 @' a6 q# A" p padding:1px;6 O V8 z* [: |/ f; d4 g: U
margin:0px;}
6 B! |6 o+ v. m9 b</style>, a2 G0 M& m% V/ T3 p. E1 P
<script language="javascript">
( S6 Z& m& y. m8 s& E<!--
! U% h V* X& C' Pfunction rv()0 i# ~1 ~/ r$ i( \' L) L% N/ T( M
{0 H. H$ ^- ?4 i) B- f
var val="";$ V; U' y1 Y6 e. ^( c3 w
for(i=0;i<combo_box.list2.length;i++){" G# q* ~% n2 {0 X8 R
val+=","+combo_box.list2.value;
5 W' G$ I6 \" v# f3 _7 C; d }/ k, }+ S, E! A$ p0 Z* G. ?2 c
if(val.charat(0)==","){. }" i3 `7 P& a0 t" d q
val=val.substr(1,val.length);
/ Z5 W0 x( @; q4 K$ T% f }; k" {, H( d5 ~ i8 E& ~" X3 u
opener.form1.frecname.value=val;5 o* x" I5 x" \& q( L
self.close();& ^) M, I% p+ U
}
' a( t, F! M1 R0 ^9 y* P//-->. C, c! N! M$ L4 F5 I0 d+ O0 l
</script>1 R1 \# D! q$ T! W" C
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
8 F F2 r6 V7 s/ d/ {( Q( r: s<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
2 n) D/ D4 }) ]<%$ S4 n( d. z; G6 O
cdatasource ds=new cdatasource(); //数据联结bean实例 x# R' T. U; O2 O _. a
java.sql.connection conn=ds.getconnection();# ?8 o" {& K. c n3 ?2 m
java.sql.statement stmt=null;
! F: @. g7 S" \. w java.sql.resultset rs=null;4 w6 g x8 I: O: I: S/ I
cdatacheck dc=new cdatacheck();
; Z* b; {6 a g%>* v* E% u' y$ W" P% E+ B) _
<%/ _$ ] R, s- I! q. k, j; I6 T& s
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";
, b! S4 e; V; |- k) |stmt=conn.createstatement();/ D; {! n2 |' {8 d9 P/ H( U4 ~
rs=stmt.executequery(sqlu);
$ }8 P% M# Z d' I7 g4 o7 b%>
/ _7 y, W) S$ x) h, W# h( K<script language='javascript'>
/ ?7 h: z4 ?& g# aarr = new array();$ R: M' U$ j O8 Q' t4 u- [
<% int temp=0;/ S1 F( ^* ?0 I! s( }* w
while(rs.next()), [7 j1 W- n$ }+ n* O
{
5 r, b _0 L" t) S7 Q%>" t5 `# z. V& w& Y
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");' s) p+ A- Z! n# f, t5 k4 [: p
<%2 r. x4 E7 V1 i' Y5 b
temp = temp + 1;: v& C' Q3 c! k" t/ I) R
}
- V, z6 L/ W; _%>
/ Q' {% {& q; P% X8 Z7 g! c+ _. Jtemp=<%=temp%>;6 G5 s+ J. x: i7 O% `( I
function changelocation(id){
1 u4 k1 `- l- v+ Hdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 ! x* t7 m; n- x4 \
var i = 0;
4 Q8 l; N' H8 |' s# `" jdocument.combo_box.city.options[0]=new option('-------','');
% G0 v/ G: x* Z% a8 I. E* D9 `for(i=0;i<temp;i++){ / V. ^' r2 @( _& Z2 u- W( s8 s
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] 5 E7 z& C3 Q2 `5 i/ ?
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
1 h) h4 T& O S& Y- D- h' i}
' I8 j4 e0 q& E7 y: V} & a2 D5 N3 [+ w6 x! K; ^" Q; P: R
} . a8 p5 `. R& x8 o: Z0 m
</script>5 C& Y8 H1 f* V* N
% \8 t7 e# s, ]$ Q. r- K8 N+ b* g
<form name="combo_box">
1 `+ y4 D" J: n* N3 n8 W& s8 C<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">( {0 z+ k3 e, b8 V
<tr height="24">. R m7 u% p$ z* S) w, [
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>) B' W& d* O! W& M
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
0 z" `, l5 `+ a2 U6 A. S <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>! s1 X5 o/ I8 n0 W, @: ]
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>! C: B1 T: Q2 ^# z! `& s; b0 Q2 _0 H' ^
</tr>
( \% j2 J; |* ^0 x, D. t <tr> : ~' S5 w" N$ x( D
<td>+ H/ B- F G% b
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">- H; ^- h% S8 t9 b* g
<option value="0">请选择部门 ---></option>0 m' h5 A' p- ~0 p# D: v% I
<%0 g/ x3 y t# O
string sqld="select * from tdept";
+ ?3 }8 q' f; ^' bstmt=conn.createstatement();4 \% r0 ~+ N: k3 c" `; m& @ V
rs=stmt.executequery(sqld);
8 ~& ^4 L; @/ B; R, _( R p( A1 Nwhile(rs.next())1 F* D! L7 w4 G L. y. E: w- h: ]) ]
{" i. P, f+ u# h
%>
+ t# ~" m* K5 a+ [ <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>7 c' b) ?$ E8 i% P. ~, |2 ~8 A$ L" |
<%. r* D- x% w, T+ S( \5 ^4 j
}
: e& r6 a9 s9 h%> 3 u" O* u3 M: z1 G8 ~, j
</select>+ q- O2 j! _! K5 R4 ~
</td> A$ f5 n5 Z* _, V! V$ J; y0 q
<td>% O" t4 e3 w+ L5 n0 ^+ D
<select multiple id=city style="width:150;height:200" class="bgc">
8 R+ u7 t6 p& B1 u; y* g! n </select>% q8 ~$ l% G& V& N
</td>( M# y+ U3 o0 R# ?
<td nowrap align="center" class="bgc">' M2 m& e* O3 Y$ _; q
<input type="button" value="<<" class="buttons">
$ a) c( Z3 J+ k! u, v <input type="button" value=">>" class="buttons">$ _0 `' {3 d8 U6 V+ l
</td>) _2 C) X6 Z5 h+ K' B. r
<td>
! s& Q' U) }2 p* s: @ <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
4 N2 ~+ j, J9 r </select>
( H' T! p# U9 y</td>
9 `4 Q! Y ?- N+ n% `" Y7 r </tr>. v6 m) ~: F; p% h: p
<tr class="bgc"> / O, l0 |( Q z. a8 X; S; h
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
3 a! J6 C# ?9 y5 v </tr>
$ k9 f/ S, n# h+ y& _1 I4 F0 X$ p</table>
4 o# S$ |4 X: L+ d; A1 ^' x</form>
8 k( ?8 C5 p5 J: s<script language="javascript">0 Q, O4 W. o) O' H' Q i" j
//人名移动
& h3 s. w9 s+ hfunction move(fbox, tbox) {$ d( e1 y) Z# _
var arrfbox = new array();
C) s. S% m# |+ |( I7 Kvar arrtbox = new array();
9 z5 ~8 H/ [, X) p. _9 uvar arrlookup = new array();; q V& C" m, K
var i;' |7 E4 Y( R7 ]$ \! ^
for (i = 0; i < tbox.options.length; i++) {
" B4 F% s$ F8 Z3 K' X) G6 ?arrlookup[tbox.options.text] = tbox.options.value;
+ I8 Y; @1 t: g7 `arrtbox = tbox.options.text;- B: N+ @) ?) w: z6 V
}7 S/ s2 s' G" @3 ?. H# h
var flength = 0;4 R8 B4 {1 X& k7 ?$ Q/ S. L0 k5 W
var tlength = arrtbox.length;
( d# l! R7 f) o( vfor(i = 0; i < fbox.options.length; i++) {) x7 O5 Y- K, T7 Z5 Z' h. f
arrlookup[fbox.options.text] = fbox.options.value;4 v& h) J( B; J3 G9 k3 M/ J) q
if (fbox.options.selected && fbox.options.value != "") {0 x0 Q2 |$ s" s" Q
arrtbox[tlength] = fbox.options.text;
0 H6 {/ f; Y" d! Wtlength++;- J- L% K) W7 k
}' r2 ^! V. t3 o$ h0 Q6 ^( i2 b
else {* p, h3 w7 x" o/ U: w7 f6 _7 \. z' _
arrfbox[flength] = fbox.options.text;
/ ?. H2 v% A5 h4 g" T. g7 Wflength++;
% x0 j5 W( e* }7 z }: d: n v+ w2 X# H! r: [: ^
}8 [, Z }( C( o; k' w' Q! N& g3 q3 ~
arrfbox.sort();( K$ H9 c6 q! Q( J/ V3 n
arrtbox.sort();! @2 T; q, F1 s( ~1 D
9 \+ F/ P! H4 Y9 x5 }7 ]$ f7 q$ }fbox.length = 0;
. C" t4 E% Y" O6 E( ^" w$ M/ m. xtbox.length = 0;& U [4 t( r! N9 K1 X" m
var c;5 R. k8 D7 S6 `% K( i* `$ P
for(c = 0; c < arrfbox.length; c++) {
; x6 E/ t* R4 c% S+ gvar no = new option();! d5 q, W' O7 z% m
no.value = arrlookup[arrfbox[c]];& f3 ]8 o2 }: F8 ^0 J9 B, F r
no.text = arrfbox[c];) G! P4 l6 r7 A3 J6 D; P
fbox[c] = no;
0 M( ^- H- G. g7 k) `+ F}% |$ Y, i: Q. M' ?4 ^3 Q) a
for(c = 0; c < arrtbox.length; c++) {. h! F6 m7 _" E# O
var no = new option();
; h9 v- A5 _+ A, [/ {2 R! Nno.value = arrlookup[arrtbox[c]];
$ Z" u& \- s ]% J9 X# w; Gno.text = arrtbox[c];7 c: u5 A/ q: s3 O) ~" H! X7 l8 _
tbox[c] = no;: `5 u+ n# _' [. w9 @. c2 \
}
; i% z) U# Z" [0 b}5 _! F2 ]) `) w: G% s+ ^
</script>, y. |2 Q3 Q+ D5 y8 m! e9 W! H
</body>
, t7 D$ w* [# ?, K- J* {/ z, | |
|