|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14375
- 金币
- 2473
- 威望
- 1647
- 贡献
- 1421
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"8 G; {+ M* F' E7 w4 C0 U
c pageencoding="gb2312"$ j; U, | e, S8 |( G
%>$ C. z4 L2 d p, m
<style>1 j. Y' E: H7 Y' x- U- S7 d
.f9{ font-size:9pt; }
9 {* N5 _3 u' b2 C.bgc{ background-color:#aecaf9; color: #0033ff }
7 n. t- y' B% }6 L* M2 F.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;% P3 r9 d0 q& ?- b; ^
border-bottom: solid 1px #4e7dc1;8 @: j9 n7 ]; ^
border-left: solid 1px #aecaf9;
! q) C- ^1 B* s. e7 z border-right: solid 1px #5679bd;
- {3 F. Z2 ?' P padding:1px;" T0 b$ m3 {. |3 B$ ` D
margin:0px;}
* e+ f& B' T- h" D# y* R</style>9 E* w0 j" l$ u7 k& H
<script language="javascript">
* Y% J& V3 M @<!--
8 {( O* P. d! b/ C! ]: r! Wfunction rv(): T2 M) P+ t7 \6 J9 J0 h* K
{) \0 t7 e, g" T. ^
var val="";
5 o( V4 Y, K. C+ n0 p/ K- N4 U4 Y( I for(i=0;i<combo_box.list2.length;i++){% ~! f6 u, h) B4 t
val+=","+combo_box.list2.value;; D* ^" c1 Y3 M
}; {- z6 l& p i. n* m
if(val.charat(0)==","){
' P/ h- y5 b6 I% i+ `2 P' h val=val.substr(1,val.length);" H4 c J u G2 {7 A( u1 c, N; g- P
}. `; ^5 L0 n4 U) B
opener.form1.frecname.value=val;
) e8 w; R" ^1 c4 ^" V( e1 Z self.close();" @) V/ `. ~: ]+ Z9 ]6 B
}) n8 E1 v+ d/ P( [$ ~3 w' X
//-->
' ^$ N0 `+ a! N: G3 x</script>
3 a7 H) U" h: S2 r<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">5 z. @ @9 J. P) m1 K4 V7 ?% i- `
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />6 u4 |# k4 G3 P* {+ s& }1 g! K
<%0 z2 _9 S! Z1 V
cdatasource ds=new cdatasource(); //数据联结bean实例0 p, ]1 V# U4 r3 Q; Z1 [; n2 d
java.sql.connection conn=ds.getconnection();
9 [! Z; k5 T* }4 f$ R+ g% e& S: o/ { java.sql.statement stmt=null;4 z3 \8 E7 e& z3 l3 |! U
java.sql.resultset rs=null;" Q$ ?% Y% n7 v6 C, q0 C+ x
cdatacheck dc=new cdatacheck();
) @# m; M/ K1 V1 i% q8 s%>: n* n! j4 x9 G
<%
" y4 T$ T9 C* n! pstring 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";
7 [6 b8 ?/ b& M0 m& Nstmt=conn.createstatement();
) @: C- o' \% \# v8 D& [2 ?" Qrs=stmt.executequery(sqlu);
+ G- ]7 U" I6 z1 Q$ q- n6 w' Z6 e%>7 h4 { e0 _# N4 |
<script language='javascript'>
; T$ _" u0 ]8 `7 D4 @arr = new array();$ X# ?& Q1 |5 ?) a$ ]
<% int temp=0;5 Z# s+ M# m0 @4 o8 o* f2 ]
while(rs.next())
- ~% n4 e M3 L \# a( Q{
. P+ Z9 L! Z$ X4 k* K2 q%>
3 S1 x) g/ Q0 i& _arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");( s! [% @# L4 C/ e2 `% K
<%
& Z# f5 C, L4 K/ y+ Htemp = temp + 1;/ q7 I7 E/ A3 h N9 l4 ]; b
}5 d( k6 n5 t. r; r2 }2 z7 r$ V5 e; f
%>
% ]+ I. e+ `2 } J6 T0 ?( _temp=<%=temp%>;& C" W8 F" S7 E8 b: |; k
function changelocation(id){
2 v7 i4 f( H) k/ N7 [$ \$ E' P( K6 bdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 + n2 `! K) z+ h3 `
var i = 0; ( I' z+ P6 a( F" |. D( s
document.combo_box.city.options[0]=new option('-------','');
& a1 Z& r3 T" o1 w1 Yfor(i=0;i<temp;i++){ . A3 o. w, f) `5 d; ^
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
3 E4 V: U+ a( Udocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); $ n; |7 x& H/ b9 T. u( R
} ) U& T, T2 f6 G/ y* Z$ x
}
8 h& p9 m1 q" U: G& k8 z} - x& d1 h5 a) y- o4 U) Z
</script>4 y; G, w; t- N1 s) D7 ?. L5 r
; A% a& ]7 T- j9 |
<form name="combo_box">
1 f5 \6 M k! N- F0 V# W4 E<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">. D) K e) v! l" z
<tr height="24">/ c J+ s& V6 U, C
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>2 R" m; F8 e- F5 u, x0 o' V
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>4 t4 T9 k' \, ]
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
9 J# o+ Y4 |; p. Q; f- s. @ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
1 T( L: N/ G9 c" r% t </tr> \% f2 s9 v% z0 o/ @
<tr>
! }, t2 f* f3 J: v1 r" k! y8 z <td>3 ?1 _* Q- |* A; y3 }1 v
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">; w. d9 B9 u3 i3 n |
<option value="0">请选择部门 ---></option>
! ^* R6 j( G1 p' z2 b9 c! c0 S<%
% W" e' S: e3 A3 T9 E+ ^3 l+ i string sqld="select * from tdept";5 r4 O4 B7 O3 [ U; K: x7 K& {
stmt=conn.createstatement();0 ^8 s3 U9 q+ S& d9 a( N
rs=stmt.executequery(sqld);
. _0 c# c4 m9 F+ j! }& dwhile(rs.next())
% u8 L9 r0 M4 V- I5 P; t8 m& r) ]{
- Z8 @; M; @* `9 J- M. P( Q( K%>
' O5 [( a4 D V( h. P2 q% |8 {0 z Q <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
. J! T; k% f3 ]! N0 N7 ?. m<%, o" a7 h* D6 |
}# k8 n; r$ ?+ g7 S% r4 O, A
%> 4 k$ b3 q# c. V, s
</select>
, D& B/ X. r8 H7 p5 Z</td>
. D, Z/ I! c$ }- p <td>: O) z% C. [( U- t( d6 s
<select multiple id=city style="width:150;height:200" class="bgc">
% G: e, r' L1 I </select>
: g4 u6 I5 i9 S# c</td>
7 n" d) ~* ~5 p. k. E6 T/ M( J <td nowrap align="center" class="bgc">; @5 Q% w9 @5 e2 x
<input type="button" value="<<" class="buttons">* J% C; P/ i5 P7 j- E( k
<input type="button" value=">>" class="buttons">/ C: S" o7 q2 n" G4 o9 o- J0 s9 b
</td>. S3 l ]$ i4 G: D( M5 m; ^
<td>* h! Q0 F1 E& B) x+ o
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
( V z8 Q1 ?( Q </select>
, {$ P' O( p- ^7 R1 K) l5 c</td> ^, o& G( a8 r- X. ]/ u: {
</tr>
6 U) i( L) Y# U% L3 V8 I <tr class="bgc">
: ^9 x) A2 {( r8 {' M. R! B <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>( T/ i2 w! D3 \, X" ~8 l5 u' z
</tr># d3 ~" V$ @$ {' s
</table>1 V e6 L5 [. ^; x+ A% X, F1 a
</form>
/ D! j, ]1 a7 \- ~9 L5 d<script language="javascript">
: E& K8 s& h Y$ F- G8 r6 ~5 t. ?//人名移动4 D7 m& |! y# r' f+ q
function move(fbox, tbox) {
" a/ E% w! |" \# Y/ K9 Yvar arrfbox = new array();5 f, m6 m- h4 ^( ~" W+ f% w# a
var arrtbox = new array();
: V* V4 Y, L( y2 q9 mvar arrlookup = new array();5 t9 r5 @$ L0 [: Q' Z) y
var i;
7 h! F% F! ]3 z2 ^for (i = 0; i < tbox.options.length; i++) {3 x6 M$ _, I7 }* I
arrlookup[tbox.options.text] = tbox.options.value;% E5 x7 I! M' e5 ]
arrtbox = tbox.options.text;
: R. h& W0 m* V; g}
. z" ~3 G+ i. _# Z2 b5 u4 mvar flength = 0;
6 O1 Q: K0 E" f! Jvar tlength = arrtbox.length;6 U0 G+ S) G8 ?) {
for(i = 0; i < fbox.options.length; i++) {
- `$ }/ U4 Z- Z/ ]9 m/ V# Larrlookup[fbox.options.text] = fbox.options.value;/ g$ ]4 V$ p( }0 \4 q0 v3 e
if (fbox.options.selected && fbox.options.value != "") {! r8 [8 C* L5 L0 Q _1 } e
arrtbox[tlength] = fbox.options.text;
) y* g# Z4 \& n# Q' W. P0 itlength++;
, l5 x2 k! M2 A7 Y4 p}
y1 \0 a4 _4 E/ t/ A* T0 pelse {$ a4 e! b R$ G
arrfbox[flength] = fbox.options.text;
# \! O: [! H) fflength++;
- P+ H, [/ @( t6 S8 @ }/ U. a1 d j! J, K
}: f7 G4 f3 O$ B9 M$ N6 K
arrfbox.sort();% b a V+ C! L4 m
arrtbox.sort();- \9 m1 V2 |2 Y( c2 k
, p' m- E" W) U5 a6 ]' _ H; q1 i& Mfbox.length = 0;
- O3 Q8 D* C7 _# v0 E( O% }tbox.length = 0;
% C( B' v$ e. @6 q1 z8 O( P- pvar c;
& x4 z: Y/ t9 V" L1 `# f8 S4 M2 ^for(c = 0; c < arrfbox.length; c++) {
0 N1 c, O& }" |( e$ |5 f7 [var no = new option();
* K6 z4 o1 s6 Y$ e2 }5 h: X! R' O0 c5 ano.value = arrlookup[arrfbox[c]];
1 `4 h2 T$ \: }3 pno.text = arrfbox[c];) G1 q9 Z4 W& ?1 J, B3 h
fbox[c] = no;
. `; S7 [* d' Y}) g' h6 W' E- J7 `. m
for(c = 0; c < arrtbox.length; c++) {4 w0 v; L X$ B, p
var no = new option();
0 q; T4 D N. ^$ L& Bno.value = arrlookup[arrtbox[c]];
$ m% Q/ j/ o) N r# o0 gno.text = arrtbox[c];
' x% i. `3 g, d4 h; d; Vtbox[c] = no;) K. x# p4 }5 i2 N9 K' E2 r
}, ~0 f, Y, `" C) b
}& R4 M5 g) S4 A
</script>4 Q, B) `. G+ }! D0 \
</body>+ u- y) h3 ^/ Y# @& F2 G* S6 N
|
|