|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14393
- 金币
- 2482
- 威望
- 1647
- 贡献
- 1430
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;" N. Y' m7 M& B Y
c pageencoding="gb2312"
' |* `1 ]% P6 ~5 R- j%>: O. m8 U6 w, e
<style>. ?$ Z: \/ z4 o l2 M+ J& p
.f9{ font-size:9pt; }
9 s: T3 b4 ]% W.bgc{ background-color:#aecaf9; color: #0033ff }/ W8 g4 y% Y# t
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
+ s1 U- {0 e# S. w Q. Q; O; D b border-bottom: solid 1px #4e7dc1;
5 [: q4 |5 X o/ ^. P border-left: solid 1px #aecaf9;7 a, F. n; C+ Z# n1 l, S
border-right: solid 1px #5679bd;
6 [5 R* F; c- S padding:1px;
5 N* c& f) C, C9 Q margin:0px;}0 [! |0 [. {% j. S, \) R$ H
</style>
0 y& j3 S8 o5 K- X b<script language="javascript">6 e p/ c" R5 p. N F
<!--( @2 P9 E6 \8 k" L0 {' q0 K+ U# c
function rv()
# e7 i) y/ l+ H* v+ E2 X7 t, ]{
" ~; l( L; ]0 X$ O4 a' ^ var val="";
0 e" C5 T8 D, S9 b for(i=0;i<combo_box.list2.length;i++){( }- P8 @& k8 d
val+=","+combo_box.list2.value;& x( q- M. f* _- M
}
" V+ o! p" a+ J( o, @8 H$ N: K if(val.charat(0)==","){* p! C z3 D, _: u; i" h+ K1 s P
val=val.substr(1,val.length);/ `+ P* X9 N$ S/ J) S% x7 h' a" H9 D
}, B2 O n+ r. S
opener.form1.frecname.value=val;
: v' m# f- B% `$ z9 O9 C' N! Y9 z self.close();
# d7 p! ]9 ]7 F5 c}8 \! l; w- m: o2 A- H$ L
//-->
) |, v$ S- Z( C: f% }* z" x8 `8 r</script>
/ J7 z' N" q9 L; v: V<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">; C/ a( g" a: d
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />& M* d4 ]/ G8 Z+ k
<%
# b7 S- s/ J1 M7 G cdatasource ds=new cdatasource(); //数据联结bean实例
0 t) v* C; B& n7 u2 i java.sql.connection conn=ds.getconnection();+ _. h/ s- ^8 u. x' C
java.sql.statement stmt=null;* H- j; \8 u( P: d# [9 ^0 K$ L: P
java.sql.resultset rs=null;3 U5 y: T" P* n: ^! u3 c1 v
cdatacheck dc=new cdatacheck();
: H* p1 |: ]" ?$ h%>' N6 A/ W$ e% {( g4 t
<%
3 c& v7 f1 z3 J* F# Qstring 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";- L2 l$ x) P* X5 o' D
stmt=conn.createstatement();
5 C+ |* a1 q( B' z) qrs=stmt.executequery(sqlu);
0 o8 k9 c F1 b& V8 B& o& e- z%>! q2 o% M" f' {$ ?/ I
<script language='javascript'># L, G+ q' ~- o6 B
arr = new array();
: k. V+ W0 q$ J<% int temp=0;
. \8 Z- L% p1 G% rwhile(rs.next())
( l# ]# f: G9 Y& W+ F{; W7 W1 i/ \6 j# m( }" Z5 J
%>
0 q: B- ~4 x* G5 w1 h) ~2 narr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
: D) @5 b+ A. ~- Q<%
5 R+ |6 b0 L' C p4 w. o1 Vtemp = temp + 1;# S, ` b1 [& x9 e
}% B7 ?3 D5 {$ x( W9 n8 [
%>* ^ I" V$ C# S
temp=<%=temp%>;
P( H* |; E' G; l! S4 Q6 a& dfunction changelocation(id){ 8 ^0 V; p! W$ `* |' O& U
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 ; u' V6 z9 U9 h+ N/ n" q6 [
var i = 0;
. C+ V+ W1 U& n( n* Sdocument.combo_box.city.options[0]=new option('-------','');
' }, z* E0 j5 V5 M5 \ Pfor(i=0;i<temp;i++){ ; Z% u$ |# }4 G/ ]' }
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] ( h/ T$ P) G" r) K2 U2 @5 S. s
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); 6 D* _2 h8 H8 v& _! I* r; S
} & V* ]) i ]* Z* I% A% B; ?
} - Z# ?% s! u$ h( ]
}
: s( }5 @& F/ f</script>9 q; w" `- w. x/ N
# [4 z* A& r7 g# I* R
<form name="combo_box">; `, y' E- P- {& j W6 L5 _# e
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
% S+ O- d& d( a <tr height="24">
. R' c' x9 J; a! C' w5 C <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>6 T4 N$ D8 R8 g e9 P) Z/ Q2 V8 A
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
* k6 W- b1 t0 i3 J2 Q0 f# H <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>% _0 c( k0 U+ C/ c( L6 Z
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
* T# E; P9 u: s+ a) C6 j! C </tr>5 N) x- D( U: j W1 U
<tr> " Q1 o6 W& L; q, q6 o, H, `
<td>, h, K0 [3 \# ~ }. h: A& ~, r
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">3 ?, D$ d Y7 Z' E s( E
<option value="0">请选择部门 ---></option>
" _, X1 D7 o' z0 |<%
% {9 O6 R: \# g* K+ X string sqld="select * from tdept";% o6 j3 D y9 r# b+ G
stmt=conn.createstatement();( V5 {: \" R: O8 _; K2 c0 r# h
rs=stmt.executequery(sqld);
" L5 {( M% _- @7 W# e3 [while(rs.next())5 b8 P, q' N9 D1 ^
{
9 O. |$ e$ x! I9 M5 [3 u( a0 \: `( Z%>
7 o: Z6 b9 K% g <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>& E2 }" K! V! ~2 w
<%3 ^, X- c: ` o: F/ X
}
+ ^% b( P) }/ k%>
3 X$ x$ U! {7 T+ n </select>+ X$ d) q l- `/ j m" W R2 B
</td>
2 R/ n. {7 d( v& ?6 w <td>
1 T3 ?/ e. }6 N+ g* d <select multiple id=city style="width:150;height:200" class="bgc">
* V" g% f8 h; F b; q </select>+ ^# t) M2 ]6 y: C8 B% m
</td>" E) Z6 B+ I* \, k. t) c2 `$ D
<td nowrap align="center" class="bgc">1 c% @; \! L& Y5 F
<input type="button" value="<<" class="buttons">
. [! ~5 u, Q& r* o4 J <input type="button" value=">>" class="buttons"># P( B% e& P5 ~" ?: J- k
</td>
+ i; ?: f( ~3 }( i; i <td>/ A0 w( K* a$ Y8 S
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">* a( }+ d+ x2 D% P
</select>( l- x( n/ N7 B- V7 j' v
</td>: |/ ]% c' F# A
</tr>- e& d6 A0 w2 o& H
<tr class="bgc"> 4 |# }; }! S: G h( g8 J
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
: u+ e. u- p% E) `8 M, I </tr>
8 d$ S4 R7 _0 v1 Y5 x</table>
2 ]- w* ~! s/ y# ~4 {6 n</form>
4 I: H* H0 L t+ q$ D q<script language="javascript">, U* \$ [, j3 e: E
//人名移动$ J& j/ c& U+ L8 Z' }1 l. H3 S
function move(fbox, tbox) {' [. H: c6 W2 Y% ^" [
var arrfbox = new array();3 k+ ~+ V' w; f% P
var arrtbox = new array();5 ?5 N; j7 E0 o. x( X$ \7 X. t1 D
var arrlookup = new array();6 I7 x. H5 I& t |1 N
var i;
% n4 T0 M% O7 X- ^. S+ qfor (i = 0; i < tbox.options.length; i++) {
# k# p3 d9 k% d% B8 h( P# Varrlookup[tbox.options.text] = tbox.options.value;. k8 M( V# o! X# l/ S+ I' F
arrtbox = tbox.options.text;2 o, ^0 \9 P0 [- {
}; ?# c# I# t/ S$ ~) T9 I
var flength = 0;
+ u* H/ n2 k2 Ovar tlength = arrtbox.length;& `" M5 b$ }: y1 n
for(i = 0; i < fbox.options.length; i++) {6 c2 B7 n1 H" X _' a
arrlookup[fbox.options.text] = fbox.options.value;- o9 W7 Q1 K- x9 K
if (fbox.options.selected && fbox.options.value != "") {7 f) i6 x! ~, l0 `
arrtbox[tlength] = fbox.options.text;
" o4 E6 j y% c. i# ztlength++;# N! z5 o+ N6 a/ O% I
}
/ R3 ^7 `! l; E4 I0 r0 l/ Lelse {
' d# y, X, @: E+ l' Narrfbox[flength] = fbox.options.text;
5 a6 ]+ b' t6 P! q( Iflength++;
9 t2 v/ l8 ~% o0 y) B9 X: }4 W }
: ?0 k( |: Y5 n8 Q9 x, D# o}
; S8 X7 X! I8 g# M) \) D3 e Karrfbox.sort();
, K# d$ k3 G, w7 Y; Y# Parrtbox.sort();
* ?3 ]/ ^8 j) g6 W( C$ M7 Y9 T6 }7 e
) O" U J. T+ @fbox.length = 0;2 q# T: P6 r* f# s" D9 u, F
tbox.length = 0;
3 X# ^% w1 D5 v# b& Fvar c;
8 k8 \ f* f3 R* @4 ]/ [for(c = 0; c < arrfbox.length; c++) {; d* P7 Y" N+ a* m3 Y+ e! T L
var no = new option();
( S5 [3 ]7 ~' L2 Ono.value = arrlookup[arrfbox[c]];
& O% C$ e9 h' fno.text = arrfbox[c];, `8 c7 I3 B3 o( z: n3 w9 |# e+ V4 s% F$ y
fbox[c] = no;
1 ]/ ]1 b" q0 F' v% z2 z B}
3 @$ |3 A" m/ P2 c2 Mfor(c = 0; c < arrtbox.length; c++) {' r d1 o1 L, y8 a& |: T
var no = new option();
6 s' _! w: A: I) m% \no.value = arrlookup[arrtbox[c]];+ U7 d# i% E( @* R7 n
no.text = arrtbox[c];
5 d" {! O& E$ B4 s- Z5 f3 btbox[c] = no;7 K; e$ ` b) Z, B# O
}
7 D0 Q" d; } f0 `5 W}2 \" [: i+ O! m5 E8 R( G
</script>
% e% l5 M: O( d+ Q7 `, K2 y</body>
) Q8 F2 Z# j ^+ O2 ]4 G8 f* u |
|