|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14479
- 金币
- 2525
- 威望
- 1647
- 贡献
- 1473
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"% w" Z% ?& h+ Z; n9 l+ j
c pageencoding="gb2312": ~* {- k+ O- K! a/ v- R( `8 w
%>, i( H7 Z- u0 c/ O7 x, S
<style>
# @' e( P6 G1 ?( z.f9{ font-size:9pt; }2 y# B! m$ T# }' P4 E
.bgc{ background-color:#aecaf9; color: #0033ff }
2 L+ a. d. {) h1 Q.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;- j) @/ |" h2 |7 ~
border-bottom: solid 1px #4e7dc1;
3 i) d B& W! i Q2 z; j! H border-left: solid 1px #aecaf9;# U* o1 T c# ^! R3 B
border-right: solid 1px #5679bd;: V! o+ \9 P1 J) o7 v v
padding:1px;
* m) n* b. s C, Y U margin:0px;}
5 }0 _5 q7 i7 t- o( _/ N! o$ _</style>6 Q, q5 J+ c8 S2 p
<script language="javascript">
# K d; y2 x9 y4 j! N) Q$ C<!--
; H% o5 h& R% mfunction rv()9 t% R$ X% f$ M$ m$ A& z4 o0 I
{5 f9 s0 m9 w0 \0 t# @* s, C
var val="";
/ z- x+ [- b; `! T. z( M for(i=0;i<combo_box.list2.length;i++){ {$ w+ }6 c r. D! N
val+=","+combo_box.list2.value;
' o: o3 Z a) `: p/ E$ L6 { }
4 Z* q: l2 L h* b$ i% x3 L" L if(val.charat(0)==","){
( ]9 i9 E* U4 z+ t val=val.substr(1,val.length);
* A* g9 y# ]& A1 @- H }' \2 v( K* ]- m% a" P
opener.form1.frecname.value=val;) v7 o H# L1 s+ f' f
self.close();
3 {6 B9 x% F- ], J. z) \# k}5 P0 N) ?* [, T- A# `
//-->
, o! _" Z4 H# i3 B+ ]* h</script>3 Z t5 |5 G5 T3 b `6 g% J
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
& }, O9 O# y! P) T" [. B) {<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
9 g* D- v; T2 x5 j# |% F<%: v5 H, G* Q2 X2 r) b
cdatasource ds=new cdatasource(); //数据联结bean实例
4 V# c0 f4 L6 }; d8 N java.sql.connection conn=ds.getconnection();
0 N& T$ |4 U& J9 ?, J8 p3 z java.sql.statement stmt=null;! g, ^) e9 H; c. G3 [+ {2 F
java.sql.resultset rs=null;
$ Z4 ` d) V1 d! W cdatacheck dc=new cdatacheck();
5 I: D) H3 \0 X%>
- v% _6 W, l- C; k7 Y: ~) _7 w<%' i: i" J" @5 }0 g5 R! [, T2 ^
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";+ Y# r% V b, h5 ~5 j6 w
stmt=conn.createstatement();
! q6 [6 [, _( C0 X$ c( [, Xrs=stmt.executequery(sqlu);& R5 X8 \0 k7 C% c8 T/ }+ W4 Y
%>
. J/ c% _) F: q<script language='javascript'>
6 K* L) G5 S3 K* r) J2 m- karr = new array();( Y! H# d7 w/ Z7 D* Z
<% int temp=0;
6 J: c2 I1 l8 }& M, S, H5 E1 I- @while(rs.next())2 }* O6 i$ a8 @; t2 }2 @
{0 k! p4 |- |: _6 u
%>" C2 z; k# B: Z( ], i N! S+ O
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
% E. M! N3 C0 r8 N<%- e6 Y o- O/ e/ f# F
temp = temp + 1;
8 r$ w5 I( w A9 ^9 i}( H/ t# ]! l W8 X$ W0 j& L3 P
%>! H s4 O; k" }8 O: ?' J& ~* b
temp=<%=temp%>;) D- O/ q4 ^* G' M7 a' w. J
function changelocation(id){
+ f; E' r& Y6 D0 g5 p+ Qdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
" p+ r3 `( A6 {var i = 0;
. @7 \5 `4 G0 I! P Tdocument.combo_box.city.options[0]=new option('-------',''); 5 s) m. c0 Q% D) D$ M. j6 ]: i: t/ g
for(i=0;i<temp;i++){
: D1 t+ H/ D% L$ o. Sif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] 8 A) M! n4 ? g6 x- ^
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
: U4 T! h- I7 @}
! S: P7 G) U3 g6 S3 V}
3 H' L' H$ s. ^9 K( b}
& t( T: ?1 c, |2 K' @5 I9 S8 f' E4 R</script>4 Z* A1 l. m" G
% m4 V" V# ]% B<form name="combo_box">4 H" s! x3 {4 X: x4 u: q
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
. _- z' {8 L- { <tr height="24">$ ~0 x$ n' q6 F( U5 D
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>' y& l$ M5 u8 x6 g6 }
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
* c& }4 I {/ X0 x( X6 A <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
+ O6 L( i; q4 \: _& f, \: U, R+ j$ O <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>1 O5 y- R' U2 E: `+ N) \
</tr>+ c* X( ^3 y2 {* O4 r3 p+ B
<tr>
- u& u/ A) e* ~9 v6 @+ [% g <td>
4 C3 O# R I' L- \( g( @# z <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">, U* `, o* D" [8 G7 \
<option value="0">请选择部门 ---></option>
2 s0 v) ?( R7 z% P<%! M2 n# Q' t3 z) S$ R( R
string sqld="select * from tdept";/ E8 a6 \3 v `8 ^( B3 _1 R0 ]& C" p
stmt=conn.createstatement();
' S c7 M3 W7 Y+ B( o) w0 Drs=stmt.executequery(sqld);
( e/ }: z9 ?- D Q) h: O X* z& ewhile(rs.next())
1 i- c7 f- f/ t7 b{
4 |- b3 }; P' u* B+ y$ V%>
; L) f3 c/ R% |8 V <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
' c( Q5 u" m) k/ O! l1 c5 b<%
- z0 h3 Y& m& F; Q8 s1 E}
% T5 r( q( n! X( I" ^%> . L: I7 E8 x3 |* ~
</select>
0 p2 k' \9 q, T0 n. u) d/ F</td>) v$ F% S6 }8 B
<td>& ?1 V. \: \! G' [, i3 j
<select multiple id=city style="width:150;height:200" class="bgc">7 N0 `, { n* _ `( \" ?
</select>
8 L2 Z; \' p* B</td>
' n2 C0 c; V7 H$ m3 y4 _6 b <td nowrap align="center" class="bgc">6 [5 V& o: q! o4 B5 L+ c
<input type="button" value="<<" class="buttons">' ~% Y& I) P! \) \. U
<input type="button" value=">>" class="buttons">
0 \6 Y1 p2 o: _ A</td>
$ i; A. `5 o1 U" j6 P* `% m <td>% Y6 @7 V" G" C+ ]* a3 b
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
: g, q( R- s" ]- b V# d( ? </select>5 b. K; K6 s8 ^: q
</td>" m% L- a. [$ F7 ^ ^, k( [6 F
</tr>
. t1 c# W! T6 p$ Q$ f <tr class="bgc">
" j( s# R9 |( }* j- X$ @ <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
( g5 l! u2 |: s2 H+ w' k </tr>: w) K7 N' Q6 b, e
</table>
7 T) Q8 F, ~6 V- X' v. s# P# {0 x</form>4 G) c. s4 n S2 S) n4 D1 @- L
<script language="javascript">
. \# H1 F6 w6 L7 G//人名移动
6 B- F2 _9 [( c. h) y7 q# e2 O! gfunction move(fbox, tbox) {
5 h. p6 T8 Z/ ~, R3 Y' D. ]var arrfbox = new array();
2 H& R* f5 f$ l+ [, Z$ v% jvar arrtbox = new array();
6 Y0 E2 y( N1 t( {& M' [/ V5 Gvar arrlookup = new array();) S9 C! R. g; t' H5 N# j7 I9 ^
var i;
* v8 \% c! w' @* Nfor (i = 0; i < tbox.options.length; i++) {
" n" T( S4 T4 i! ]4 a* Earrlookup[tbox.options.text] = tbox.options.value;
. z9 z* G3 _& b2 i+ o5 Garrtbox = tbox.options.text;
: b6 X7 ~6 Z) d E4 j2 Y* h) C}) g, H) [3 b, N0 s3 K% Y
var flength = 0;
: T$ b0 h9 D% s; l" mvar tlength = arrtbox.length;
& w; |; a) l1 K: J" D; g6 Afor(i = 0; i < fbox.options.length; i++) {4 B/ }; G; n# T+ ^" t4 |
arrlookup[fbox.options.text] = fbox.options.value;
" K3 Q5 `9 c, U3 X4 r" b! X% v! nif (fbox.options.selected && fbox.options.value != "") {' ^& l" \6 V. v" n) Z- i& @* J
arrtbox[tlength] = fbox.options.text;
9 k" r+ i' M Z, ]7 ]tlength++;9 ~9 e R) z1 Q$ O0 u. r* H! Y
}8 ~- v- E, z7 h V
else {& o+ v; Q y2 K5 S& [. \3 ^
arrfbox[flength] = fbox.options.text;
3 D6 C C" B' Aflength++;
. r' P) ?. T: [" j* X5 E U }
" V5 N4 N( S3 j}$ [# q8 |% P) W3 _0 m! ~# [; P! |
arrfbox.sort();
' @3 Z& @3 J/ {% O+ ?) Karrtbox.sort();/ K. V" _! \) T; a
! R( M6 S/ H2 U* h0 O/ A" r
fbox.length = 0;
1 J+ ^3 Y, P% P3 etbox.length = 0;
/ C; P% n1 _) \ tvar c;0 R3 Q& q0 C$ {' Q
for(c = 0; c < arrfbox.length; c++) {
7 {; w8 ?, E; T1 m# dvar no = new option();
' f' y- h% x/ E5 | l' s1 t# Ono.value = arrlookup[arrfbox[c]];
4 g/ @ g2 a: b+ h B: Z \) `- R ~no.text = arrfbox[c];
) s: ^% R! c9 u8 gfbox[c] = no;# G& x: t5 Q$ b
}
2 R5 \3 _( Y0 h7 A9 h: K& tfor(c = 0; c < arrtbox.length; c++) {
9 v0 O0 A* o1 ?- Z+ yvar no = new option();# M* m% N5 |. @) m" @$ Q, q( a* I" i7 B+ U
no.value = arrlookup[arrtbox[c]];7 m; A6 o. `, D9 Z' X8 v" `
no.text = arrtbox[c];& A# i: a/ B6 K+ p* n
tbox[c] = no;
* D5 a1 y1 |# I0 L% W/ F }( W. a* \/ k5 t
}1 A" D1 u( [( d5 a" F$ f
</script>
: C$ K5 g5 V% c: f# J</body># F% s v! |1 P& ?" i
|
|