|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14389
- 金币
- 2480
- 威望
- 1647
- 贡献
- 1428
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
( G3 D2 K c6 Y( x c pageencoding="gb2312"
( X5 Y0 Z) X. g- v; O' [%>; o8 V1 M! k( }+ b
<style>
: F3 o8 w0 g9 k.f9{ font-size:9pt; }2 O5 [+ v3 Q/ R1 k; x; X
.bgc{ background-color:#aecaf9; color: #0033ff }: C0 ` F* {& H/ y' `- h; ^
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;$ E, \4 j- L& _' N
border-bottom: solid 1px #4e7dc1;
) J. B# V. z/ ]/ ?) h7 o5 D- U6 s border-left: solid 1px #aecaf9;2 N3 i4 H/ ~( I( h: z
border-right: solid 1px #5679bd;
6 W6 J& }- O- W* [ padding:1px;' U6 V( V! p6 h8 K( Q
margin:0px;}
1 {& a) ?- R$ [# z- H</style>
$ V$ a; r3 K& ?' K" {4 ]9 o' [<script language="javascript">
5 k, s% S9 ~6 w. v3 u" G/ G<!--
6 }7 w3 g T& ~0 y$ }7 W& Ffunction rv()
( I8 |, ]3 w) O% V{% z" @5 A) r: v$ u% ~
var val="";/ S3 B) V% b6 M1 J6 u2 \
for(i=0;i<combo_box.list2.length;i++){- @6 @, Y/ ~2 t6 Y& C
val+=","+combo_box.list2.value;* N+ H/ r" L- X; }. ~5 D
}( V5 [% _) f$ [( Q+ \
if(val.charat(0)==","){
- O) I! y' K+ D5 P6 j val=val.substr(1,val.length);
% g: e G# y4 a1 S6 U& z3 M }
! k, g9 ~3 ]2 e opener.form1.frecname.value=val;' o! ?% M1 q, C x8 ]
self.close();1 j; U: W; O0 }' P. F1 U6 @
}
( a4 v, y G9 w; ^* S//-->
' p+ s+ S4 T' p; v' W$ b</script>
9 j; W$ v. ~, W* a* ^$ Z<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
/ P1 Y4 x/ |& O# Q<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
. ~/ ?" s7 [& J. q* A<%
$ ~5 _3 @$ Q( Q# K! j6 g& R cdatasource ds=new cdatasource(); //数据联结bean实例
. N# h2 n9 z, _' X) y' c4 @ java.sql.connection conn=ds.getconnection();/ ?1 m1 t; h2 E8 }
java.sql.statement stmt=null; {% s7 A6 H- N3 m9 X
java.sql.resultset rs=null;# e' C; F/ l, T: u& z0 \& ]7 L' p
cdatacheck dc=new cdatacheck();
8 M( ^ O' E" h" @, V$ Q7 G2 w& u% R%>) u8 v7 C5 i8 F5 h! M
<%( e6 W" o2 @0 b( ?; R0 ~
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";% U+ H1 }7 b7 P& {7 f" i) {. b
stmt=conn.createstatement();
- S4 Z; }& n# y8 t% u8 srs=stmt.executequery(sqlu);, P3 K5 H2 g8 x! Z0 _' @
%>* E, G/ W; ]) f/ l; `
<script language='javascript'>
0 ]* y4 S2 k8 ?arr = new array();' z. B& r$ G( _ W
<% int temp=0;
7 V+ J4 V5 [6 S6 B5 K/ Lwhile(rs.next())
2 W v# D7 ^* v0 e{
# a0 W# a4 x& i W: [- c; ]%># d: f+ [: [- ^9 _
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");. q" n5 |6 c) k
<%0 H1 U3 A- F$ L$ m
temp = temp + 1;
# ^7 R# ~3 j( B; {8 C0 k( ^}4 {' D* w# N1 M7 i0 x: d7 x+ ]
%>* |0 o0 J7 E# `9 y/ P
temp=<%=temp%>;
" n( E4 S" C6 V; hfunction changelocation(id){ ( {6 m9 C1 G5 o9 o) ?/ I
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
0 R0 S5 o( c% U, {# Yvar i = 0;
5 g: N9 p# J" V7 P$ c- T* Y3 Mdocument.combo_box.city.options[0]=new option('-------','');
5 Q! j# r7 m: j( Z w. Ifor(i=0;i<temp;i++){
, F$ T8 I7 U4 J% sif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] + _0 N1 z/ F' W8 W% i; }9 m
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); 6 z* ~" K {4 m- x& g, V6 k' K! x
} 9 E5 q' {3 E+ I* i, t, V; ^
}
3 e) B2 }$ Y, H3 Y3 g, P. v @} * I# _+ ^/ q5 h% ^# _1 @9 k. k
</script>
8 S+ }' D; ~% j( [$ i: s6 x
, R, h0 p% |$ D<form name="combo_box">
4 B4 ~* Z) @7 L% {! ^<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">* I5 v6 `4 r+ ?6 V+ b5 f5 x% D6 i9 O
<tr height="24">
' q t1 E% C+ ^* P# q2 l- U8 v$ m <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
. v0 Q0 P* d/ k# n <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
7 R0 C& a; s2 L8 m6 ~* i <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>! {/ N% P! c' _8 L4 w
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
$ o# Z0 {1 l+ P% a" o$ L3 _% i5 \ </tr>
+ F2 n8 f! r+ m4 t, f: X: r <tr> / C* z3 G4 A6 V
<td>- ]/ \) m& c5 z! B- z
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
8 u* v. x' t$ Y3 f, H <option value="0">请选择部门 ---></option>
7 {, D* y0 b6 i& V# V V) g- u9 R<%# h9 k' ?9 r$ i' J( D
string sqld="select * from tdept";7 @1 Q; N+ [( S
stmt=conn.createstatement();9 a: T, U" s0 A, `* Z0 Q
rs=stmt.executequery(sqld);
2 K8 V% y3 ?2 G1 Twhile(rs.next())9 y4 n. W% Q3 L1 E
{' W. d# _3 o0 \8 X0 i% b9 _
%>
7 J t8 h; |) c <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
7 M* H# `2 \ j2 U1 s7 {<%
$ s# F/ s3 W4 T: L: k0 V3 |}
* [" @; N- C8 w' L0 _%>
: ~( C! \9 u; l8 A! n, e0 u( p </select>
% Y2 o; ^" ~5 N9 l</td>
" f1 }4 H: }7 M; Y <td>; |8 i& `; t. r3 i! F8 t$ v
<select multiple id=city style="width:150;height:200" class="bgc">: i6 D5 X9 j- S0 h: ~ g% V
</select>
* @3 N7 l! f9 [& f</td>2 N/ v" b, D$ k; C9 \
<td nowrap align="center" class="bgc">
! V+ Q- g( G8 E4 ~% T$ c <input type="button" value="<<" class="buttons">0 F& D ^! n+ a m. m' C
<input type="button" value=">>" class="buttons">
7 u* C! ~" L0 i$ f. [/ T</td>. v7 A4 V4 V. G: D* B) E
<td>
5 H" n$ T. |+ X9 \1 _ <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
6 |: l9 [( s+ q1 p: t </select>
) e- i, r2 F8 k</td>* x5 h3 Y1 b/ X
</tr>: G! |- E" l1 Y' c
<tr class="bgc"> % f) f% c6 s* b& h' C
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>3 {6 C& b. L: [) U
</tr>
0 L5 o* K9 I, x B) H1 w</table>/ s I+ A9 _: }+ ^; D
</form>8 m5 G" }0 A) |
<script language="javascript">
# [2 J$ }. D. }( X//人名移动
! D) C& I+ W3 Hfunction move(fbox, tbox) {/ j3 s I& g0 _8 m/ B8 i
var arrfbox = new array();
# L# R$ U: `0 U; N& nvar arrtbox = new array();
4 P; W: F1 z6 _8 nvar arrlookup = new array();* [% K9 b. f9 p! Q# o
var i;
- P B+ m- e& }5 z0 Lfor (i = 0; i < tbox.options.length; i++) {
% ^3 D0 P( o+ x5 T: xarrlookup[tbox.options.text] = tbox.options.value; u1 ]. F$ a& z- x
arrtbox = tbox.options.text;/ N5 j9 t) w. ]! I- d* r F
}
. _% J& [! O* q2 ] P+ }3 z) dvar flength = 0;
, ]) F/ s& o' S, I6 hvar tlength = arrtbox.length;
9 ]" U! `! x6 ]4 }) f& D4 T! efor(i = 0; i < fbox.options.length; i++) {
! o E% k$ |! F0 j; Sarrlookup[fbox.options.text] = fbox.options.value;
( G$ s+ x+ V: L# P# Q- V# Z9 Tif (fbox.options.selected && fbox.options.value != "") {
2 Q' c3 ^$ F# ] h$ K) Farrtbox[tlength] = fbox.options.text;
* e6 u6 k( p! i( V: }( htlength++;6 @) [0 E8 c5 I2 s8 h
}; f: T" H9 w4 k- H2 _
else {
$ ^( z3 n. O6 k- f# \" `arrfbox[flength] = fbox.options.text;6 K7 S+ q! C/ \7 U0 {
flength++;0 J; v9 b0 X# k. v3 z& w
}
) k, \9 D3 H- x" q9 L9 F}
8 J1 ^8 K5 D5 v/ {! Iarrfbox.sort();
: n6 y D8 D5 S; Xarrtbox.sort();
5 U4 a& F0 P) k0 Q" O, q7 I, m
! o1 t& c/ L# @' s, efbox.length = 0;
8 v8 F9 r6 B& \tbox.length = 0;
; B0 Y; w- r& u' ?var c;
; \) j# ~% \' \for(c = 0; c < arrfbox.length; c++) {, F7 h; y0 d( C% y" [/ K$ c9 K
var no = new option();
P; h. b7 R* |0 Q, X: l8 O$ Hno.value = arrlookup[arrfbox[c]];" T7 E7 i5 K. J1 m! U& x1 I3 h# K
no.text = arrfbox[c];( r$ l1 ~6 u0 c- |3 U8 y- q
fbox[c] = no;
) a! p- _4 m0 t$ c, A3 B, Y}
/ G6 e7 v* `1 K. F8 O1 `for(c = 0; c < arrtbox.length; c++) {0 ^8 l/ H' B! h- z
var no = new option();
5 y; u" Y) {% H, Z+ M. j( A4 fno.value = arrlookup[arrtbox[c]];
0 a5 ^2 \8 c3 e# u- l4 Wno.text = arrtbox[c];4 \0 d+ t# F+ ^2 K8 U. Z# v
tbox[c] = no;
/ j8 t" B4 U6 } }
$ r5 K; D0 Y" v}
/ R& O6 }2 |$ v6 J0 A/ D3 i</script>: p2 y$ ~% k! U7 p7 B1 Q
</body>
C# S- n" u5 I5 C! L1 k" ~5 u |
|