|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14435
- 金币
- 2503
- 威望
- 1647
- 贡献
- 1451
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;" p7 H( f R2 L" G% e& V* c
c pageencoding="gb2312"6 N, D6 Y6 ?! P
%>
+ o }& Y7 ?0 i) P2 z6 W9 Q8 _<style>
- U) b! O* T' ~4 r. s- b.f9{ font-size:9pt; }- e1 i8 C+ f5 ~4 b& Z$ \% u* n
.bgc{ background-color:#aecaf9; color: #0033ff }
5 Y1 O- k* P9 e2 C7 y3 q.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
8 l# ^8 X! w; `0 p border-bottom: solid 1px #4e7dc1;
, O) {* h s! P0 s6 R u3 Q border-left: solid 1px #aecaf9;
# U2 ]8 B# M& K1 \3 ^8 C border-right: solid 1px #5679bd;
' z# s0 D" W) {4 U2 a padding:1px;
6 y) n# g! f! G margin:0px;}
' p9 \3 S% ~0 O: x# F</style>
, q$ k7 L- p0 {! N" D<script language="javascript">1 W- [- d1 h) g- N. C7 T3 U7 q
<!--0 {/ i0 x4 R5 S4 ~
function rv()/ M1 \ n. N9 g, `
{
! j7 X* d3 K2 N! H% ] var val="";
* n% r) _1 C' d* { for(i=0;i<combo_box.list2.length;i++){% F% E- w- f C% \' y' M
val+=","+combo_box.list2.value; V: h |* `( u" O/ R
}8 E1 S9 Q# ?* ]- k. B5 `1 G
if(val.charat(0)==","){4 i& F; r- f/ G( H' A
val=val.substr(1,val.length);
. N/ r* Y3 b- @+ J6 r6 d4 J" l }0 `+ U" r$ u9 T7 K: l
opener.form1.frecname.value=val;$ `3 y/ z+ M6 H
self.close();/ i$ A# |8 e6 K |8 D" U
}
* l/ H; H! i; \ a% `' h//-->+ ^' Q; B2 d9 K1 I, x* g
</script>! g9 S3 y6 c7 H
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
; `+ d/ ?, Q) D( x' _$ Y& o<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
) z% a" \7 j, N' E6 r& u5 `<%
% O# ^% u' V" ]4 a+ z4 S cdatasource ds=new cdatasource(); //数据联结bean实例
+ i1 i E: |% b# g) R7 j java.sql.connection conn=ds.getconnection();5 E; @+ h6 v+ V+ |( ]+ `5 H
java.sql.statement stmt=null;
- f* q: w2 B! N, e" R( o% V. t0 p java.sql.resultset rs=null;3 C$ T7 o+ }; v3 c
cdatacheck dc=new cdatacheck();
9 s/ y3 n4 h; f) b5 S+ d%>
' c% l) Y6 ]0 h# ^' E<%& S F7 r6 ~3 v' w# h/ F
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";
0 G3 U, t& Z& v- S$ @" ?4 jstmt=conn.createstatement();, ^0 U# A+ ^. i! |" X q
rs=stmt.executequery(sqlu);
! \' d- q6 Z. s/ B! I2 ]%>. `9 O8 f( {& r* S
<script language='javascript'>
* N- ?' K1 ^1 K) P6 h! qarr = new array();
' [; T6 z4 m1 e2 ^<% int temp=0;$ p7 h( s: X7 |* P$ m9 s
while(rs.next()): a3 F) x& Q- O) |
{
$ _+ g. k2 E1 T4 D: z%>
$ U1 Z: I0 X6 F: }6 h1 ?arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
5 J5 h+ i) b( q1 }/ V" t' f<%
1 u* a2 c- S: V; j. p ktemp = temp + 1;
2 c( K' p6 _- b' L} ?( T# F4 D3 C d: \9 L7 \
%>
! j1 r0 M8 g& @0 q/ @; `& {temp=<%=temp%>;
+ y+ i" ]) U, E$ q9 Xfunction changelocation(id){ ; N7 d k6 ~7 F
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
# _/ P1 M% Q' f. C- Qvar i = 0;
! C$ R _3 v% l) K7 a5 n# D: D5 F- Ddocument.combo_box.city.options[0]=new option('-------','');
( `6 _$ ~1 K. t( o. f& lfor(i=0;i<temp;i++){
- e* ~4 G: k7 Iif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] + w- H, W. `- @/ r& _
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); ( Y6 ?6 I' d0 ?# M" a
} # \ v7 p. U; P* Y# {
} 9 Q# Y) L) _1 c/ J
} " K$ ]/ i3 [8 t0 M/ a3 U
</script>
% ^+ f6 Y" r9 m* ^! T. H1 E, _- Y* A, T1 t6 z2 W5 P
<form name="combo_box">
+ O$ h- }; G" v5 }3 [<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">/ C5 Q1 A' a2 B$ C; }3 H
<tr height="24">
0 s3 e3 V* J, U <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>; @2 _7 ~8 t. \+ M! C) g
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
?7 f' B) s6 ]# ^* W1 V" | <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>- b) R( |& z7 T% [- W6 K# \
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
+ E- ^0 Q; h2 E </tr>. k- s* m; k& T( N6 x& j5 { [
<tr>
7 K. I( Z* Q- W+ K) T9 H% @' {1 ^ <td>
2 f* q/ F/ i5 i) L2 Z <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
- E4 T$ A2 y$ @6 P; `" u <option value="0">请选择部门 ---></option>
3 s% F: f7 E. h/ x) E/ G<%
5 g6 I8 \! C% p& S' [4 U; A+ K" Y9 w+ X: Y string sqld="select * from tdept";# u& d& V0 i* L Y
stmt=conn.createstatement();
6 A+ k/ Q1 Y4 J: [4 E( ors=stmt.executequery(sqld);
! U8 w8 t! u+ ^8 L, j1 Z" Hwhile(rs.next())* I! R. V; x: c9 n
{. t6 Q0 }8 G' D4 m
%>0 t4 f4 W$ s9 j( v
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>) [3 \1 O$ p1 ^7 g% b+ U* t
<%
9 d8 B, ]! Y/ j$ }) Y}, _1 e2 j; E4 {3 Y; b7 J
%> $ A; {9 d0 V2 ^; M' N. A
</select>! ~# m& C2 t& F5 O
</td>8 X' s. Q7 W- \0 C3 i" c( F) r
<td>- g1 ?8 E9 {4 r1 x* `, G% `" H" W n
<select multiple id=city style="width:150;height:200" class="bgc">6 u2 r# f' d, W8 a
</select>6 k6 e% i+ n5 y3 W0 ^4 f4 G4 b
</td>
& A z; y+ s) C) D- H <td nowrap align="center" class="bgc">: c6 ~: [% U5 Z* r1 j" \/ v
<input type="button" value="<<" class="buttons">
* R* C2 t; k9 r3 o8 ?9 f <input type="button" value=">>" class="buttons">4 s! J9 r& F: B) m
</td>! O/ o( H6 x2 J* C
<td>
1 Y' F4 a5 `2 @2 `$ [ <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
& V9 s- k$ W/ Y. E: D' E8 i& i </select>8 a( S% c& P o! a& h# L& R
</td>
7 }3 ?1 L- o9 o4 U! ` </tr>
, I( r- K- ~5 I! w# m) d. S <tr class="bgc">
! F. k; W9 }- O/ Z1 U <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
# b# ^4 k" Q, O! h </tr>
* e7 m6 E6 B! u% w6 m</table>
1 x: f4 I9 v7 m3 l& F% y) _% M6 X</form>7 R- j o9 L9 e# M# L R
<script language="javascript">! h8 D4 m5 k& R. p$ V; s" [7 }
//人名移动6 p9 i% A" ]( l; D0 i6 ?
function move(fbox, tbox) {
: n, n9 g- e5 W7 [2 s* r5 {var arrfbox = new array();/ y* @' V! q y+ v
var arrtbox = new array();+ z7 ?: k" R5 X& K! V& ]
var arrlookup = new array();
3 W3 w! w" X; d0 l$ G8 n# P3 b( Fvar i;! O# _, w) e, ~1 U- J
for (i = 0; i < tbox.options.length; i++) {+ j: h7 Z U& u4 X& e. h6 E5 b
arrlookup[tbox.options.text] = tbox.options.value; k; J ^1 }% A M, C& Y U0 ^
arrtbox = tbox.options.text;# }$ z; A* ?# v7 ?6 W5 E. B' l7 U4 X
}
( e. K) H2 D* fvar flength = 0;/ D( y" O& Y8 C7 g' _7 V6 h: }% P; r
var tlength = arrtbox.length;
6 ?& Q% A% X4 h6 x# P- Yfor(i = 0; i < fbox.options.length; i++) {! @' F) j! @; A" m+ n# ?
arrlookup[fbox.options.text] = fbox.options.value;
4 F1 ]' G1 Y8 x6 Fif (fbox.options.selected && fbox.options.value != "") {
1 ~( F8 P7 u; {9 y s2 @- b' z6 Harrtbox[tlength] = fbox.options.text;- ~9 w( Y/ N" ~ x
tlength++;
( Q) x, q4 _6 t1 b, h( _( t3 e+ Z& W}7 U4 k2 p; Z9 R/ l
else {+ b5 P: h$ [. s0 X) Y, X
arrfbox[flength] = fbox.options.text;8 A/ A* s! T" S3 ?. h- P
flength++;# A2 f7 g" U% s1 _9 i
}
) x; t$ a, t- W* e- [# a6 {/ T}. f. x9 W8 ~2 `/ E2 J7 D" I1 ^
arrfbox.sort();+ O+ i; Y# O& ]) u9 o
arrtbox.sort();
* k+ ? n1 |0 A |, Z+ Z9 D) m" D6 E) J
fbox.length = 0;
6 O. P3 m5 q, ?; f+ Htbox.length = 0;; w7 m( f0 L! @: B Q( `+ _8 o
var c; s8 y( @3 J3 _) ?
for(c = 0; c < arrfbox.length; c++) {" i# c, A. ? Y0 @; D& s
var no = new option();
5 t( M c) G2 i4 v+ cno.value = arrlookup[arrfbox[c]];
; T" R, w9 y3 \" uno.text = arrfbox[c];! y5 T# B/ T# ?+ W( n6 [* Q8 o
fbox[c] = no;
! S5 @& E: a s: H; x}
7 S/ K" d0 j/ r: r; G+ T+ ^for(c = 0; c < arrtbox.length; c++) {, m/ u8 ]4 i C
var no = new option();" Q! q3 X0 c$ `( M. S+ c2 K
no.value = arrlookup[arrtbox[c]];3 |3 H) O x# @0 ^ u8 Y
no.text = arrtbox[c];
0 w% i& M. M+ q; c5 X, j$ r" Wtbox[c] = no;1 w* z! E; r/ L2 y1 O- t
}
# W+ S6 J4 ~' w7 D! ^. H9 f: h1 X}
& g3 f% m( p C# B9 O4 T. k& i6 {</script>. y# y( ~5 r x4 Y4 r! ~$ W. y
</body>
) }& V% d" f% L7 ~* l+ T+ w |
|