  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14153
- 金币
- 2367
- 威望
- 1647
- 贡献
- 1315
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;". W' l* j- o0 g5 `
c pageencoding="gb2312"
. W7 M& a, u5 C4 S%>
: @6 V: ~ b( a$ r7 H1 |1 ]) |1 P4 v<style>
5 D) v( f. i$ J.f9{ font-size:9pt; }# r/ J2 o; e4 E" X; S
.bgc{ background-color:#aecaf9; color: #0033ff }
1 `$ C5 Y6 f$ d5 D. f' b2 p.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
$ q# ]7 y3 _9 i* U. S" h4 U border-bottom: solid 1px #4e7dc1;2 ^ W2 _0 o* ~' c: Y
border-left: solid 1px #aecaf9;4 G) P# o' B3 U. A
border-right: solid 1px #5679bd;+ t. C: N1 p! U+ y+ \
padding:1px;
. _( ~2 ?# P7 w3 G! R margin:0px;}- [" _ L% t: F: Y/ n. e
</style>
2 ^0 i6 J3 d) U- _<script language="javascript">
6 d1 X3 _5 N! C$ W% |! ?0 f<!--* E& g% E9 N+ X/ O
function rv()% c( \' {' Z: C
{
9 o0 V) L$ a7 d7 E var val="";
, s& ~' T. s- G- B for(i=0;i<combo_box.list2.length;i++){& M6 {9 c$ A2 W' |) m) e) H
val+=","+combo_box.list2.value; e9 L8 H. \) }9 H! K/ p: k$ A
}; l8 j+ t ^+ B. i
if(val.charat(0)==","){
( b* ^; ]% ]; S! T. F val=val.substr(1,val.length);$ T* V, x0 a e* I7 J- {
}
* a d% @. ~, c& q) |; B2 {/ p7 { opener.form1.frecname.value=val;6 Z; {( T* K3 i; g
self.close();
7 W$ j1 V: D# p3 m W" `+ u y* w}
1 X3 `( Y, l* a$ @- C//-->
r9 z }, |( N5 O" K</script>1 Q. }( J+ S/ E5 O8 } z9 n
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">- E4 z* z. Y* W, |! _. q
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
" o, g: z" P; I9 r<%
) v4 N% O! s2 `6 H cdatasource ds=new cdatasource(); //数据联结bean实例
9 O$ E; |( k$ o. S) i' X; B java.sql.connection conn=ds.getconnection();
, N: |9 Q9 g1 j( E4 ?/ i: @ java.sql.statement stmt=null;/ K, O: W3 l; p
java.sql.resultset rs=null;
; x" Y, B4 b2 V- r( x& j cdatacheck dc=new cdatacheck();0 z t) `& T) U5 T
%>* M+ E# w- h7 F5 w- j% [( Z
<%7 k! e6 Q/ ]% ]4 q/ F7 ^1 t3 V ~& n
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";
- ?0 T8 \" A- M: A2 u8 C: Sstmt=conn.createstatement();0 [# S7 u6 N# I0 O2 L
rs=stmt.executequery(sqlu);# v6 ~. A. e# Z, h& p+ C! N
%>
9 V) I0 U" a: z0 Q7 L9 i0 d% P<script language='javascript'>$ ^- k8 c4 W6 r
arr = new array();
5 W! _) @: ^% R T9 ] A<% int temp=0;; J+ s! E; z/ g1 }# n7 M# g
while(rs.next())4 v0 Q& C C" u! L
{, ?" j6 f* }" z# J* ]3 }( w
%>2 W6 ^' D6 |. b. \
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
k0 V1 z) b( a<%
' q+ P7 U; `8 u1 ?temp = temp + 1; J+ E L: V* U* p) ^! ~1 J
}
: x( f* s: e' A$ l$ K5 K; Q+ {2 k%>9 I6 r: n g4 O4 f0 o4 a* `
temp=<%=temp%>;2 T" B9 \0 ]6 J$ _- n- ]
function changelocation(id){ + I& f1 X: \) s- L& C Q
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 " _: [# Z) W c- v) O
var i = 0;
0 h9 c! U5 X0 Y9 r5 mdocument.combo_box.city.options[0]=new option('-------','');
& j# V" `, g) H6 I& G( I9 |' I$ f) l% ofor(i=0;i<temp;i++){
; ^1 ^/ k e# k' Z2 P$ _% y2 zif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] ; N; O0 s# ]. _+ o
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
k% R/ q+ `0 q- G/ W+ f}
+ E- j3 H# z1 t: b6 A( W2 b, |} $ B, s6 p0 C4 X+ M z
} " q6 Z. o7 E `+ Z$ G. z& f
</script>
5 m' r2 {% t. m/ c
8 {. X- |9 i& H3 N, u3 F6 i<form name="combo_box">
& w' U3 I9 Q1 ~! m/ @, x<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
$ o/ `% |7 i( M <tr height="24">
6 Y9 D }- n3 E% U, s4 M+ T& O <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>4 W3 }# j0 O3 \1 P/ t5 R6 T
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>; @6 X2 O2 j7 m4 j3 X3 V p
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
P) N# k' K+ t4 B <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
/ j1 g0 C: w5 B% D </tr>, ?" X7 S* i6 Y% q0 c* t2 y
<tr>
- Z1 y3 W' p1 k8 D" n& Y6 E! Y! X <td>3 Y* \) ~, g% R" B! Z
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
" Q! G/ a9 |" I- u0 w, m- d: X8 j3 e' M <option value="0">请选择部门 ---></option>
( v" _& O$ u; A3 c; l1 o3 H$ k<%) o5 q, b1 e$ x
string sqld="select * from tdept";
0 [' u3 |4 j$ \. e1 H7 ~9 ?stmt=conn.createstatement();
! [7 J, ~+ y7 o% Q1 o: ors=stmt.executequery(sqld); }& s# L: Q6 w) @ l" ]& D) A
while(rs.next())+ J/ A8 d6 V' W, x1 ]6 X- F
{
4 Q- A( v' I0 A6 w4 I u; K4 j. t4 i%>
/ I( i& U, ?& J' X2 P <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>- H* G) t+ L2 ~- n% J% ~
<%
: G& t- s% s& X( t8 B: D}
* G! b1 }- h5 J( T7 g%> ) E: a X% a" y: B0 v% o" v2 a/ t& t
</select>
4 b: S6 d+ \7 L; z: S' Q) p- p</td>
9 l5 M6 {( t& f- s# m! k2 g <td>5 h. {$ C6 |6 P$ q7 {! q
<select multiple id=city style="width:150;height:200" class="bgc">3 Z! U# |% d! I7 p& ?/ u5 `2 G
</select>
: G. C! A1 ], O5 g( z</td>- d3 B' Y. C7 p
<td nowrap align="center" class="bgc"># a) E4 K( ~! m! b+ S
<input type="button" value="<<" class="buttons">
- O- [1 o% A" Z3 l2 f <input type="button" value=">>" class="buttons">2 z$ ^) C; T4 D$ y2 i! x: x
</td>
2 y) [$ K" m* ?) {* t <td>
1 Q3 j0 Q4 [- t& U ~ <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">- l: ?' F0 C9 Z
</select>: F: o) _8 E' ~5 A' j
</td>
' C6 W5 ~, a% `' y* I; {- s </tr>
1 ]/ D0 {, `; e <tr class="bgc"> ) L' o0 c2 E7 U! U
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
- o. |# j* q+ I* K' R) s( q </tr>4 `3 H. j5 G$ h) B. g- U! s
</table>
8 b: \' h* x! Q0 H: W</form>
! J- n ]1 ]( o2 N+ W0 `' g<script language="javascript">
) A4 a$ q) k! X//人名移动. R4 q+ g; s4 g# e! i
function move(fbox, tbox) {
# o2 \& ]! Q$ y! u5 e8 L2 F# ?var arrfbox = new array();
9 B2 y* i5 n! q" {6 yvar arrtbox = new array();
7 C, f" c/ c- ?- x- gvar arrlookup = new array();* K. |- F( v3 y; ?; X$ P5 R( g U3 |
var i;; F/ f$ Y& ^8 r8 L
for (i = 0; i < tbox.options.length; i++) {
! p7 M# V9 \+ t1 R6 Harrlookup[tbox.options.text] = tbox.options.value;
0 M/ U7 K; D. d+ |( s5 c9 `arrtbox = tbox.options.text;
( b- T ?# s" H5 v2 G* q2 O+ s}- l/ x. f9 A- r9 I
var flength = 0;
0 H! U' B% C" f4 A# \2 @5 s3 Nvar tlength = arrtbox.length;) T2 `$ {" N2 Q1 J: E1 l
for(i = 0; i < fbox.options.length; i++) {2 ?# H6 E1 u& ?1 g
arrlookup[fbox.options.text] = fbox.options.value;7 n. l( ?* d- r
if (fbox.options.selected && fbox.options.value != "") {+ h+ b# c/ a8 G4 M1 E: `" }4 V& w
arrtbox[tlength] = fbox.options.text;
! b# j" \0 p8 l7 o5 Otlength++;
6 \$ v9 f/ L. v. V. D9 }}
8 u8 c! x- @7 ?; e& f5 Celse { R- [! c H; a6 ~6 b
arrfbox[flength] = fbox.options.text;
$ u9 p, I- Q. K" B) A9 Pflength++;
7 ?0 B5 D% ^1 y2 y/ B7 Z6 G }
) t- b9 {, y$ j# S}7 q9 G, U6 x2 Q
arrfbox.sort();( Y( u' v) f4 h- h; B( H
arrtbox.sort();
$ O: W- V/ F5 b' Q, N/ T5 i7 S' |1 l& A) m$ Z8 Z* q1 f# p
fbox.length = 0;6 N$ ~+ L) k( }" x9 R* V
tbox.length = 0;
0 `* t/ A$ h3 U% mvar c;4 p+ I' y7 p% m8 N0 U, y% U+ Q" ]
for(c = 0; c < arrfbox.length; c++) {
3 I0 o* {; m' z0 \var no = new option();' [/ b' H/ ^: Y
no.value = arrlookup[arrfbox[c]];
) A% ~' X* g7 k y% g5 sno.text = arrfbox[c];
2 l4 ^6 Q# D& e: y3 _9 a" f1 |0 jfbox[c] = no;
/ \; C# g% H2 x, J+ b}7 R, H. C$ a( ^# F+ f
for(c = 0; c < arrtbox.length; c++) {* K) p) A, D, M/ W% f( A
var no = new option();5 L: q, ^# P' r- J% O8 J2 a4 @2 R/ B
no.value = arrlookup[arrtbox[c]];8 ?) w! m. v) N2 P* }- g2 i/ m; a$ c
no.text = arrtbox[c];: |2 f- b n. l {6 I1 _
tbox[c] = no;) y4 p! [; q3 Z3 z
}( p }( U4 L7 e
}5 U. R: q4 F' H
</script>
: T( j8 g8 D- Y+ V c7 h</body>
# c' ]- w; [1 n- E# G |
|