|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14429
- 金币
- 2500
- 威望
- 1647
- 贡献
- 1448
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"2 g1 `, ~( N6 z
c pageencoding="gb2312"5 E# Y9 v4 w& \# b/ O1 R. Y/ |* B: l
%>
2 z) f8 s3 e7 Q* f<style> b6 B2 H+ N2 @ C0 s2 C3 l
.f9{ font-size:9pt; }; w. m8 V. B9 z5 r& w; \
.bgc{ background-color:#aecaf9; color: #0033ff }3 R" I; }, R% Y2 B' y, ?
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;6 ?6 R3 F3 @" \1 V. D7 D& f
border-bottom: solid 1px #4e7dc1;
* j- p, b% Q) C3 D, `. Y* a( j/ y border-left: solid 1px #aecaf9;1 v6 h3 [4 P% y* \! j' ^
border-right: solid 1px #5679bd;
x* O- z# `; L8 U padding:1px;
- P6 Q$ N' V8 A, F margin:0px;}' n$ q9 g% Z9 h2 A/ }- S
</style>
# S$ W+ X9 c2 `1 F O& z' X+ \<script language="javascript">3 Z/ B* U( u9 z Q P, g3 g
<!--
. n; L5 y; i1 S8 y& X* [9 ~& G' yfunction rv()
8 g/ ^( [* R; G. i4 ~4 }{, g: z3 j, s- M
var val="";
8 I. r a' ^2 H$ \ for(i=0;i<combo_box.list2.length;i++){
/ R4 X: S* c! [" K val+=","+combo_box.list2.value;
' i: i, y% U ` k5 F, Y* ~3 g# e! I }6 x$ ?& [' S( t/ x; A& \
if(val.charat(0)==","){ T7 ~8 K1 f& f2 O/ O9 |3 v
val=val.substr(1,val.length);
% W" |6 P1 f: I }
! }/ S; G7 M$ X* }; l9 E opener.form1.frecname.value=val;
% R, P; g) R- D# }) \: L) p self.close();5 f, j9 Q1 s8 f0 _
}- { s: H' @# P3 m
//-->3 u$ Q- b0 B" f3 p1 N
</script>
& \6 F; ~4 j/ y/ U4 M+ }<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">9 _+ A5 x; n( m4 X! \5 C; E
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
! g1 \( R! E* }1 e; g7 V<%, q/ b8 D' @! ], C: k2 @
cdatasource ds=new cdatasource(); //数据联结bean实例
: D7 I1 r6 I& r2 a& l java.sql.connection conn=ds.getconnection();
/ h1 p6 H- ^1 r6 E. z java.sql.statement stmt=null;: d% i% B) d5 k4 {
java.sql.resultset rs=null;6 e/ j5 D9 A4 I7 v- p
cdatacheck dc=new cdatacheck();* y: w* f* ]8 K6 p* Z0 d
%>
8 O+ ~' r- H3 V8 G! }' L3 w<%
B7 M+ K! ` V) v5 m) Mstring 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";
( q ]: v% a# |) o4 jstmt=conn.createstatement();
5 B/ Z# Q2 s& i' ?: k; lrs=stmt.executequery(sqlu);
+ `' E) k! p& a% V%>
3 h `+ F7 E9 ~$ `7 n, \- h% e<script language='javascript'>
( f$ N4 `6 @+ q8 O& F# Z/ T2 u4 y+ parr = new array();+ E, V2 v- u1 ^0 d9 z9 B H5 u- L0 k
<% int temp=0;) X' k& Q9 L; n x) ?
while(rs.next())
) k6 [0 J. N+ K4 d" `: b{0 n, e! k5 g5 L( C4 p. n w( g
%>
( \+ C* _7 q% \2 larr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");& J# [( w6 y' ?9 l; W$ i
<%" s. ~" i% B: \7 J9 y K# w5 c6 }
temp = temp + 1;
% F# u9 y% V: J" _' H7 a5 X) k; Y}
! C- C( ]2 _5 i u, x; f%>
, x* v1 j9 o2 p, F# B3 ktemp=<%=temp%>;
+ M( S \7 x+ K$ f- [function changelocation(id){
; N/ d5 v' r& D) Bdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 9 h M. z0 P7 X w5 N, t' {- k6 o
var i = 0;
2 }! f0 ] |. K' Fdocument.combo_box.city.options[0]=new option('-------',''); / z1 a1 l4 L1 N7 e# L+ C
for(i=0;i<temp;i++){
0 _: q9 H( S7 p/ p4 b- d0 e0 [/ }if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] . G$ d3 ~& k& u( C3 c/ {
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); ' F3 ?, A" r, M0 N
}
8 q+ i4 _7 @# v# D$ k} 5 L7 B! J- o0 z2 i
}
$ E3 \- h# |: P</script>
6 ?0 i' O" n3 w- u! p L1 J
$ ~' d! j" h$ K8 a9 g2 L, A3 D6 b& T<form name="combo_box">0 W/ u& R3 `; @0 u i6 Q
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">7 [0 H* Z d& i& d( \
<tr height="24">
( g8 w1 X( @" J+ ? r <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
6 [8 S% G+ }, t* f <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
7 k/ ~" J% R9 B( }; | <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
( ]2 o$ T# J3 {: g% ]$ B7 ]+ L <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
' a$ [" |* L+ ^7 U4 `$ V$ E0 B- | N5 N </tr>5 d9 ^) S* W( K
<tr> . i' S4 S3 W: t2 ~3 Y# A
<td>
/ _0 ~) p3 m8 G* H$ ], O <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
( V' ]9 e/ ?& b7 t* \* c, a <option value="0">请选择部门 ---></option>% G3 W1 d; K) F; U( {
<%
4 K1 R& M3 L6 A2 T3 g# D9 |7 { string sqld="select * from tdept";, }3 i" ~6 y% [
stmt=conn.createstatement();
& Y5 J* A+ c9 x; M( |* Qrs=stmt.executequery(sqld);
9 X: [7 F: R% _4 Z0 q+ I! z3 |$ Bwhile(rs.next())6 f4 m# I5 O6 M1 m ]# Z" R% m4 t
{! q* E2 H, v5 q" i. _& Y
%>5 k8 e; d/ k- M2 p
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>& m+ @( _- r# X, x3 c p. x
<%' O" O& }$ {7 J) Y
}
! |! c, f- B* M V# \; y0 p& g+ g%> 6 z2 }6 I2 C* q
</select>5 h; {' ^( e: j; t- b; o& {5 X
</td> {3 G3 [- h6 m Q R
<td>7 t+ S3 i; d J& z! c
<select multiple id=city style="width:150;height:200" class="bgc"># v! _8 i# n' \6 y: x! P1 y
</select>
* }" u @( x6 t9 d$ Z" K q; \$ \</td>
) M' }# q* ~) b+ A( F8 M: R <td nowrap align="center" class="bgc">9 O# T6 C+ c, W" d6 t
<input type="button" value="<<" class="buttons">. x5 j* ]9 |- R$ e& o7 H( }
<input type="button" value=">>" class="buttons">
6 b* p# g- X1 D2 |% i# B" S</td>
+ P. H4 z5 n) w6 C. ~( h8 y <td>
8 P/ a9 B/ W# ?, Z <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
: U0 T* w; a0 \9 G </select>
4 v! E, g5 U9 c6 M d5 [</td>
- U, Z' A3 ?7 T+ H </tr>
5 r% n. ^- T6 L# @$ h7 S0 a <tr class="bgc"> 9 Q7 x! l3 c; X4 L o2 A% C. ]! y
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>$ l( x1 E7 b# x) R: l0 i
</tr>$ W; L8 a1 s+ p) c
</table>& y$ F4 F; \ l, b6 e L4 e* S
</form>7 _" ?/ d& `' K3 |- W) A9 ~2 W" ~
<script language="javascript">; B% w$ H, N- Q6 T9 D
//人名移动( e- C+ r, Q5 k0 O2 ?
function move(fbox, tbox) { n# w* x a# d$ @7 y, b. m$ F! w+ b1 g5 W
var arrfbox = new array();
9 E# [7 O: p8 Q# I+ jvar arrtbox = new array();
8 Y2 I- _- o4 G4 J ^# l! jvar arrlookup = new array();
R' Y0 l- ]; C Mvar i;
8 j5 z- \2 ?) m8 W% F9 }for (i = 0; i < tbox.options.length; i++) {. A/ t- y2 c* x$ M1 M& i$ H. d
arrlookup[tbox.options.text] = tbox.options.value;9 M! ^3 m& q* T/ s
arrtbox = tbox.options.text;
+ F! I: l: O+ k& e/ k% W+ {$ Q1 @}, [; i: m6 {5 @ M
var flength = 0;3 B% t0 r7 Q! ] E1 G% b
var tlength = arrtbox.length;: _. ~1 U. a8 G3 e6 W% m: Z& |
for(i = 0; i < fbox.options.length; i++) {1 E7 J* n0 c- Z0 x
arrlookup[fbox.options.text] = fbox.options.value;
2 g( s6 [& ]$ c: @ ?# kif (fbox.options.selected && fbox.options.value != "") {$ Q% b9 ?3 h s7 t. { E
arrtbox[tlength] = fbox.options.text;
6 N9 W( h0 F2 `; v1 Ctlength++;
* v3 I3 {) ?6 V- c7 m}" M' _: V# N0 E$ l3 y
else {
! J& Q m! X( m$ v( Z/ a0 p3 {* \$ ~arrfbox[flength] = fbox.options.text;1 e# p' @ r% L$ ^
flength++;
) a! K; `0 @( [5 p }: ~9 Z3 |0 E! b/ c6 n) ~' s
}) u( E; c1 M3 D: ~9 K+ o3 ^
arrfbox.sort();
7 f5 r% R/ g3 q- C) e- W* U* }arrtbox.sort();* c: m! {9 k# j9 F7 A- y3 H) a
4 o( |3 T J; X' R! q: ^& Z
fbox.length = 0;
. I0 n& E. _- K0 T* {tbox.length = 0;+ F+ Y' v. E+ R
var c;) M% X7 J d: @8 N/ [
for(c = 0; c < arrfbox.length; c++) {/ w k6 Z* |. u
var no = new option();
& c: g/ L. v+ M. p" R; o+ z* y# i3 \ Xno.value = arrlookup[arrfbox[c]];6 t2 i$ s9 e) _ Q! s0 `, S+ D8 w: i
no.text = arrfbox[c];6 I% n- p% p3 L. H7 q/ Q
fbox[c] = no;0 A$ |" h& C8 {% J
}
0 q0 S- K" h7 dfor(c = 0; c < arrtbox.length; c++) {7 N( C$ u5 B% M
var no = new option();! O5 w# j! i* d u# B# @- t! s
no.value = arrlookup[arrtbox[c]];! I) E/ T: D5 b d5 Y& J3 Z
no.text = arrtbox[c];" \; \8 ?) q. v
tbox[c] = no;
: j. U, d: l* Q }
9 G) J( k/ t1 R! D, K}4 l2 B& s( Z4 Y# n, o& Y7 }
</script># N2 \* i* q( Z' c
</body>
3 g) X: X' V* m b3 Q# i |
|