  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14197
- 金币
- 2389
- 威望
- 1647
- 贡献
- 1337
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"2 t9 R9 D% {/ z5 _: N) ` Q! _- D
c pageencoding="gb2312"
0 o R0 g6 t7 O8 Y/ J%># T; P& H/ |8 V
<style>/ \: J! ^+ D. v& @& N( W9 t- d
.f9{ font-size:9pt; }
* I: X' O- d$ k& D0 _.bgc{ background-color:#aecaf9; color: #0033ff }5 Q, c( n) d3 d
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;# J' \5 L7 }6 q0 ]9 U- E
border-bottom: solid 1px #4e7dc1;
, c- V i4 u; d5 m& ]; {5 _% J* J border-left: solid 1px #aecaf9;5 g, ]; K" }2 Y$ w1 J
border-right: solid 1px #5679bd;
9 W: D Q' `9 k+ E0 I* |2 w padding:1px;
! y: Z4 i1 Z- @) F3 o R7 C# I) r) T margin:0px;}6 o, t5 R% n8 A
</style>$ e' Q1 S. a8 m! A: E& k9 Y* G
<script language="javascript">
: f! l9 X9 Z3 x6 ]<!--
5 J* W6 f$ a8 W8 c$ Y+ F |function rv()
( M0 [1 _( H6 T% V$ {1 [{' }0 ~+ d* @# E5 i8 ]& B' P
var val="";
2 }1 u( v4 g8 I0 b; D7 Y for(i=0;i<combo_box.list2.length;i++){- L4 ~5 t9 I( c! V5 U( H! A ]( h
val+=","+combo_box.list2.value;# o+ j2 h0 f X) ]9 M( J
}
# p' T3 n( }9 q1 @% \; k6 ]& w; j' B! F if(val.charat(0)==","){* s# R' c* P0 V7 S
val=val.substr(1,val.length);
# M0 w4 R5 }9 q: m }' j) q& |" C/ F. H4 F3 ~
opener.form1.frecname.value=val;, c- G4 t, J5 Q4 K* R2 ?
self.close();* w ^" \. |/ K- i5 [& Y/ Q
}+ r" S$ I6 ~5 R' c4 [3 v0 o
//-->+ k3 J1 i& E) {: }* z
</script>& r# t! ^' J2 b) h. a1 u
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">! o1 K/ a2 q; d5 \9 Q
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />$ @% C- L5 G! s6 [% e
<%+ h) H, P3 N, Y
cdatasource ds=new cdatasource(); //数据联结bean实例
S: O. P$ |: L8 V6 E# T java.sql.connection conn=ds.getconnection();
: S- c, b5 O/ a# y java.sql.statement stmt=null;
' V" Z, V6 e, G, a( ?& ]# S4 G java.sql.resultset rs=null;
; ?, a1 A# f( m- J cdatacheck dc=new cdatacheck();
. |0 p/ m$ H7 |% S, Q%>
) Q0 n/ F3 e3 m) G8 o) A<%
' p+ }; d; X8 }7 bstring 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";4 w: ~6 Y( i! Z' Q! F1 \: i
stmt=conn.createstatement();/ O; A" o7 s. e7 s R; C2 J
rs=stmt.executequery(sqlu);
% ]+ {9 F8 h4 b. q%># G, x2 C( X( B# J. I6 [0 A$ g; k; V+ B
<script language='javascript'>
# M2 h' W( s1 h+ i) d5 marr = new array();
% f& G% U2 p; C2 k/ }# v" V* ~<% int temp=0;, M2 a. {' v1 x' k- ]! i
while(rs.next())
6 c; w1 G; j4 @2 J; ?) y0 B- r{
+ v9 l* M& [$ R6 ~' y8 l%>
0 T. G. M" O5 a$ J; |. |arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");- G+ o$ {, o: }7 A2 y
<%6 {' `: p& O# \, p+ v7 d9 ]8 M
temp = temp + 1;% w, N1 S! q$ l |& F9 x4 m
}) q8 r$ ~3 N/ Q G9 T" i9 D" L
%>
0 [8 c7 Y* @$ Ftemp=<%=temp%>;8 S6 X1 w. T% t6 \& n& a
function changelocation(id){ $ ?* W+ ~9 q, f9 L
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
* I, M; B- D- ^var i = 0;
# t! G' z3 Z4 T$ X' rdocument.combo_box.city.options[0]=new option('-------','');
; d$ p0 } B& Cfor(i=0;i<temp;i++){ 3 S! ]9 _6 T9 q K- f! W
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
( V3 ]$ s' ^" _0 |& C# ], idocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
, X, \- Q) k, j, Q5 y) h} - E1 z" B8 r. K' B! E0 S- ]
} & }; z; @. N3 _# v* p$ f5 C% V
}
2 G8 ?: M. j! B</script>, u2 ?- |0 y4 d" Q! i8 S0 D c
5 N, i, _; n; V& `: w<form name="combo_box">" m6 p% `" j8 w" z; M. S" a$ b
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">! k" D" C3 C7 L. [
<tr height="24">
- O$ m. Q: P L <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td># I7 o: U- W" V% K: P
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>4 J% E3 p. {: _$ [+ Y0 { L+ A
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>' q8 b+ w0 R8 x, w, q
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>; F( y' E0 [8 Y2 i/ l) g+ \6 w
</tr>
C6 T0 B! o( g; s2 @1 ^! P0 r$ d6 Z <tr>
4 @4 _- F3 P2 V <td>; v k9 u6 H: I t h! p( i
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">; F3 v. W( e: y$ V+ Q. I( y
<option value="0">请选择部门 ---></option>& l/ s D k4 C/ R
<%5 C$ C( c/ B* V" A w+ F) ]
string sqld="select * from tdept";
& I- I! V* [# k% bstmt=conn.createstatement();6 X& ?* }% r$ M6 [) @: u
rs=stmt.executequery(sqld);9 O9 ~$ ~+ }2 e; ]6 Z2 i" L
while(rs.next())
! S! n* n, K- p" |" |8 C6 F8 l) p{9 T8 y1 l) k9 I' ~0 R. q+ B
%> V& ]. }3 K* ^3 T( ?
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>! `( l* Y* F- Q7 X5 S7 x9 F
<%! l# y( A( l# X$ i/ q9 o! q" Z3 e' z
}
6 Z* d6 l9 ]- C4 T* w1 Y8 Y%> / W" k# d7 e4 v; M
</select>8 r2 J0 ]- S) Q/ Y
</td>
4 ~, f9 c& Q- ?/ F) O+ p <td>
' T& U/ r5 B* o) X# R <select multiple id=city style="width:150;height:200" class="bgc">
1 t% q6 U/ A* w7 B) q </select>
5 D+ R' b: a7 f$ B</td>* O. G- r0 h) O! ^( |8 t O
<td nowrap align="center" class="bgc">
5 u" G: E; K2 |: t5 }- M8 I0 \ <input type="button" value="<<" class="buttons">
( A ]' ~: z8 \8 v( i( f7 m/ R <input type="button" value=">>" class="buttons">
1 v, l4 t: Y# Z: a* i8 C</td>
b2 A8 V& ?2 I& N* `7 a h <td>* a' H( g0 V- i2 X9 r6 \
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
, W. M) }- ?. s# p& w </select>9 N5 j+ w+ o; m4 k* m) c3 W/ w) L' H2 T
</td>& ]- f; P" X5 f _ h
</tr>3 E2 f \: p( @, K
<tr class="bgc">
- Z8 k+ F+ C: B3 o3 l <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
2 v( g6 A2 ?' | </tr>
& a: i4 i a2 z0 @8 y' g% l1 i/ q</table>
4 ]; q3 H. g# G' d; w</form>: \! k: J# e' ~8 H3 [* V4 F
<script language="javascript">+ M4 _) q5 I; s" l, s
//人名移动
0 _/ l- H0 @1 r2 I" K' _function move(fbox, tbox) { H m1 W% Y: a [4 y
var arrfbox = new array();, q. G4 L1 I% |6 g) g9 t
var arrtbox = new array();
9 X4 w3 s, h [/ U. p$ x$ {var arrlookup = new array();
+ L' P, d: l2 ?0 Yvar i;/ d' Z/ b: z) q2 S0 O6 _! H, D
for (i = 0; i < tbox.options.length; i++) {
" {& T' B, B+ Z, _8 Y5 R9 Warrlookup[tbox.options.text] = tbox.options.value;
4 F- C! a7 ^) @! ?* {arrtbox = tbox.options.text;% J" X; F* C* n3 a5 v- X
}
2 }5 d5 Q& z0 a% U* F3 pvar flength = 0;
4 T( z3 o, C4 c/ xvar tlength = arrtbox.length;9 r; r6 z4 }( _8 S
for(i = 0; i < fbox.options.length; i++) {
# ~# T" F& V) { Q, @9 Qarrlookup[fbox.options.text] = fbox.options.value;- }8 B3 ~* a/ U% Q
if (fbox.options.selected && fbox.options.value != "") {
W4 d( Z. l% E1 Q3 Tarrtbox[tlength] = fbox.options.text;5 b8 Y' D3 H( E" M! _ d D. |
tlength++;
, a& ]* B/ k I& W' ]& x}
, [, I) t5 \6 \; k( U) ]else {# z( h3 R k7 R6 ^
arrfbox[flength] = fbox.options.text;8 d1 L2 k2 `7 {0 ?
flength++;
+ Q$ u& v; P1 w" _6 X5 J. _ }
9 e9 U+ ~9 j4 V! n0 l; a}& R4 g6 n. T4 k" n# y) w
arrfbox.sort();. ]5 d( K: A6 J! f1 v
arrtbox.sort();$ C3 u' ~) m4 p) O( C# ]
8 [% c ?8 \8 K8 p
fbox.length = 0;
! E, N5 z7 V' B6 P( O% r. btbox.length = 0;
( k$ z# g+ V5 Avar c;
. w4 h4 L3 m% zfor(c = 0; c < arrfbox.length; c++) {2 q# L$ M0 X8 n/ G. k, Q% V+ |* c
var no = new option();' n: g. H2 |5 L4 d. u
no.value = arrlookup[arrfbox[c]];
( s6 K( B) e, M% c! v& [+ N0 t) Dno.text = arrfbox[c]; k [: t4 f1 | r. D4 {# H4 N
fbox[c] = no;
% d+ h5 t) E# J' b. b}& Q+ E$ y9 O/ i
for(c = 0; c < arrtbox.length; c++) {
" b" M% n, Y/ T4 ^/ g1 s+ }var no = new option();# U5 n0 P0 D; u5 P$ u" o, N# G: J
no.value = arrlookup[arrtbox[c]];
. P% s9 [" O+ i' Z/ U/ J9 Xno.text = arrtbox[c];
4 Y8 y% P$ }% q0 {0 i1 Itbox[c] = no;7 |# |# r& l& P9 H
}7 J! \6 j1 ]! g3 c- N
}- L. q+ {/ f* J* B, V4 Z# s
</script>
0 v2 A0 q4 p# z* \</body>% c& O( c" Z' [- X, M6 _
|
|