|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14329
- 金币
- 2450
- 威望
- 1647
- 贡献
- 1398
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
* j Q2 M9 d$ Y3 s, ^ c pageencoding="gb2312"
I% ?' ?! k3 k* h& \%>" s9 ?7 M7 [& ^8 p; [3 }
<style>1 y6 @* Y S8 [. ? S
.f9{ font-size:9pt; }
! f. o" t5 z; O. v2 C: o.bgc{ background-color:#aecaf9; color: #0033ff }1 ^* s- g6 y8 L
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
& C& s2 v, }1 A border-bottom: solid 1px #4e7dc1;
/ {! {; J/ {, L% v0 n$ v border-left: solid 1px #aecaf9;
4 z. F- u: l2 v) ]5 T4 H% ~3 b. _( x border-right: solid 1px #5679bd;
1 l) u9 ~( f: i; Q3 ? padding:1px;
1 O$ ^9 k- e: { margin:0px;}; Z5 _1 x* v" l# p( I8 C& U' @
</style>
. W$ Y: u/ T' V% Y" V* c W. k' {- ~<script language="javascript">
; `. J& P! d( D. K% U+ d) v<!--
4 x) n5 c- M0 f `3 C) afunction rv()
4 ~7 S* ?/ o7 d7 q. L{
! Y; F/ R* L4 d6 Z var val="";& ?- C# {, K4 m
for(i=0;i<combo_box.list2.length;i++){4 [4 D; C6 ?: e4 p- }9 t
val+=","+combo_box.list2.value;
! Z( h7 F+ W6 S4 z0 C/ d }! E0 h8 w" z5 j
if(val.charat(0)==","){
" W/ A) j2 B% r0 S7 O ]& U2 \ val=val.substr(1,val.length);
6 E2 U* \0 Q! V+ N* |3 P6 G }
# c8 @8 C3 M4 q' N0 T6 X opener.form1.frecname.value=val;: M1 y# r7 j; r) w/ B c! \# M
self.close();! h- O# t: ^# M! X+ d# S/ ^9 g
}
& n! p; i% |3 ?( U) z//-->1 U: \4 Y! ~3 g. v0 _, L
</script>
' [, ^! y. b, i+ f# D* g v<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">5 j4 G ~5 S! ]* E4 O" p0 {( ~
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />) T9 {' ]; i$ ]2 h; q) h1 M/ w
<%
9 [. i, W0 `/ w$ l cdatasource ds=new cdatasource(); //数据联结bean实例3 d1 Q8 h0 Z% e
java.sql.connection conn=ds.getconnection();, u4 K; W4 `, P1 y1 R9 u! r( w; }
java.sql.statement stmt=null;4 u, k7 n! `) J3 ^ m$ D
java.sql.resultset rs=null;
J" z+ I# C( O5 V+ `' K cdatacheck dc=new cdatacheck();
8 P' W3 ^8 [) P%>
) ]- Z3 H% M4 I+ L5 g) }" B<%. `) w {) r/ g- _/ Y
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";$ R% T5 c2 U; L- w K
stmt=conn.createstatement();( s7 M* p+ U7 f$ n3 u
rs=stmt.executequery(sqlu);1 Q/ ?0 h; I9 b7 g0 ?/ w
%>
9 b% |+ |/ R" m; Z- c9 d l<script language='javascript'>1 X& h" m5 t! t; y8 p, f9 v: j! ]( C
arr = new array();4 r$ f4 d2 M, ]. {$ Y* P( ~
<% int temp=0;5 r; K; n& [# m( D' n. H# m/ w
while(rs.next())7 z4 y+ T" f( d! V' l
{
- N& O3 f! _" g3 ]# Z%>
+ J1 N3 Y+ T; C) p, }. u& Sarr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
1 V% H3 K: [; y$ @% j$ j& m<% N; M e4 n/ |; f, K, Z, H
temp = temp + 1;: x+ f2 o* }) `$ j0 p% y; F$ P$ y
}: p6 I: D. T ^
%>, B" J4 o% V# @, l% f3 u9 V/ h* Y
temp=<%=temp%>;' b0 @6 F) C8 k& _/ L$ P- O
function changelocation(id){
4 I5 m% a7 f4 `/ u" r% {2 Cdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 + J* v3 [, w# c0 k) i$ ?1 M; X) j; M2 a% g
var i = 0;
3 W0 O/ x7 G* x% x9 cdocument.combo_box.city.options[0]=new option('-------',''); % b0 ]: ]6 x. w+ d
for(i=0;i<temp;i++){ 0 V8 t( V+ f0 [
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
Q& U+ p% V& d, w7 Sdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
: \2 o/ R& y9 K5 ~. G. n* l$ Y9 P}
8 b0 g4 M7 W# {! l1 I8 O; g% _, o}
( _ t1 u* z9 R) c1 Z: r& m: d} 0 k5 T6 Z. R( Z- B) r; @$ h
</script>
- i9 V; B. H& H' G
6 O4 J& w2 U! Y3 f<form name="combo_box">
4 ?! o( d& G9 N9 p4 Z<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
- ?1 ^" N$ v6 e. l, {" Y <tr height="24">
. ~& \, f& [7 a+ m2 _) w <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>' P/ B! H! N# K' \- o( L3 P
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>) e% e/ f. P# J' s! B+ N9 I# l
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
* a5 D( T/ H0 K0 e4 V <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>" O( B* q; Q2 K' z' S
</tr>; D6 N$ G* V0 r! h$ ?
<tr> ! c. c8 P) n6 P, ^; T5 p) i* D$ D
<td>/ k" \5 H/ W; _# f" M
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
* M. T* [( k) X) I8 L+ V6 v <option value="0">请选择部门 ---></option>
* | V) x+ e' i V<%
' N0 G7 }/ W# A& G/ G2 U. b string sqld="select * from tdept";
3 _" ^3 u" ~, ^% z- kstmt=conn.createstatement();0 {5 E6 n6 I3 b& {3 { J8 u, o P
rs=stmt.executequery(sqld);. y: Y) L% ]! k$ T. M% L
while(rs.next())2 C7 B: ?, H/ C i L! ^
{
# o! y6 Z# J) s& F; N%>- R1 g. ` R. Y7 E5 {
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
' [# R2 `* f7 Z) C$ N2 W) N<%
4 R4 ~; r; r1 |8 v}* }" m' S, G5 E' a( K6 W; d2 e( T
%>
% z$ [* S2 R6 i" [) K </select>
& y( u7 `( k( G2 F' W! h/ H</td>4 b0 P- I5 l- ^0 c7 w
<td>5 |7 w; z2 U; c4 O
<select multiple id=city style="width:150;height:200" class="bgc">
# L* O- r# _; H+ F </select>
! `/ d5 s+ |: q2 Z4 u3 C$ }</td>
1 c. d; v" _& J* h4 b <td nowrap align="center" class="bgc">5 Z" R- c3 ~, P/ v/ P0 e4 r
<input type="button" value="<<" class="buttons">* | `+ N; _ r" a/ r) E
<input type="button" value=">>" class="buttons">
$ t2 c1 h8 W0 {2 X; W8 V</td>' R! f. ]; d5 r$ s1 O6 H
<td># n5 E, Q: w% N0 N4 s/ ?
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
2 ^# e! F; H8 m( G0 ~# l </select>. H3 O. P- r5 j; z
</td>9 o$ K; A4 W5 ` s7 |
</tr># s* Q: J2 X$ j0 O
<tr class="bgc">
- L( M6 B3 D$ ^ <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>) y- z T" ^/ F2 k
</tr>
! z: }& r5 a. S# V+ u) z</table>( j* Q0 G+ O& H5 G7 W& y& H# m$ j
</form>; N9 @9 x* P! C. B: `
<script language="javascript">3 n1 [; x9 {7 q+ C1 f1 O8 p
//人名移动
. \3 g1 r) G6 S; W. wfunction move(fbox, tbox) {! ?8 r, ]8 n; n1 Q" W2 E
var arrfbox = new array();
- w3 w2 s: b% dvar arrtbox = new array();
4 z6 d; y+ A( l1 bvar arrlookup = new array();" B' D; ^3 n* i" `$ M
var i;
4 Q# J; j' |8 t2 Z/ t- Cfor (i = 0; i < tbox.options.length; i++) {# y- ~# u7 C7 A7 j- M
arrlookup[tbox.options.text] = tbox.options.value;% _, L' J7 p& {0 v
arrtbox = tbox.options.text;' [5 [: i3 {1 n9 \2 t
}
. h4 D3 f$ W8 ~: N/ ivar flength = 0;% {) \$ h+ I9 o
var tlength = arrtbox.length;
; R( [+ n/ R5 W. k5 [for(i = 0; i < fbox.options.length; i++) {
- k' \( b; K- }, d0 f0 i+ Jarrlookup[fbox.options.text] = fbox.options.value;
9 O$ y2 v$ F5 x( F. dif (fbox.options.selected && fbox.options.value != "") {
$ L0 Y2 R. z* n- S- G! x+ ^& rarrtbox[tlength] = fbox.options.text;
* g+ }( Q7 A5 {: p0 Ftlength++;
/ ]/ T3 k) |2 l6 U% z a! Q}
" J3 K* {# {- |/ Relse {, C1 Q: h9 k2 }+ F9 e/ r( S
arrfbox[flength] = fbox.options.text;
7 R4 f+ w1 y8 B4 tflength++;
% V; r7 F3 n: w* t4 _$ @ }
* K2 d+ ^) e* {& | b, j, U}* c0 K. d& f* u
arrfbox.sort();
6 y! D L" u+ m5 \+ N- J/ W/ c4 Harrtbox.sort();/ e$ {+ ?( \) l8 x8 \
! y( T7 u+ i+ [* c) I3 x; @fbox.length = 0;. W- Y9 o, k3 Q
tbox.length = 0;0 }# l2 M9 N1 m6 l( b; h4 }+ ^& l
var c;, s0 w0 I$ q/ L2 E" V# w, X) b
for(c = 0; c < arrfbox.length; c++) { ]! I, w/ h( B& P
var no = new option();* i4 ~9 v8 m4 N
no.value = arrlookup[arrfbox[c]];
$ J; v- P! Z1 a0 L& I& [# h% ]no.text = arrfbox[c];
' \) t, \2 I! l: S$ y& [" zfbox[c] = no;
; x' _4 p4 H h- [! U, [4 d}
) d7 }; M6 t$ O7 k6 a# K8 Rfor(c = 0; c < arrtbox.length; c++) {# r' ` z/ t$ D
var no = new option();& t% m1 ]& B/ `' |- y
no.value = arrlookup[arrtbox[c]];
1 \, {! P) S* a; cno.text = arrtbox[c];4 k* V! g4 k# s1 P, P+ {$ f3 i9 k: N
tbox[c] = no;; Y8 h- J5 C/ {, E* ]
}
o V% b7 d4 l}4 n% v) D8 H! n, {' U
</script>7 Z, l* F0 _# Q) @& d
</body> v7 t/ K/ |# Z* X2 t: |* Q
|
|