  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14153
- 金币
- 2367
- 威望
- 1647
- 贡献
- 1315
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"6 s* r9 G% N6 E) m! u
c pageencoding="gb2312"+ u/ o: \& T2 u# v3 n; b$ s3 m
%>
& j2 ?) W+ \" N8 p" p<style>
1 P. B0 I6 K$ a1 L4 f/ W.f9{ font-size:9pt; }) }3 ^2 X3 [% P4 ^% |. E
.bgc{ background-color:#aecaf9; color: #0033ff }6 B# u8 \- g: t2 b
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;0 e) q! O# _3 k# E7 K/ @. v
border-bottom: solid 1px #4e7dc1;0 s* X+ ?& e; P7 P. |" O
border-left: solid 1px #aecaf9;
' _1 ?! p, j0 ^- A; P! U- _ border-right: solid 1px #5679bd;# N% s! t' x& |# M2 P8 s- N
padding:1px;
- l8 j- i* W1 C% w0 _ margin:0px;}
5 F q% W& a3 ^8 G7 q</style>
+ O$ g4 o& T9 Y0 ?<script language="javascript">5 `" o( X. e* W( k( I5 \+ E
<!--
6 b# @2 ] u) g$ |function rv()
& n5 Z: n8 O7 j; x- W4 G" u{$ A* `* @# ^- U! \, J5 b
var val="";
' d5 h! z0 ?9 x# x for(i=0;i<combo_box.list2.length;i++){, H7 Q+ x& c6 t3 ^6 \
val+=","+combo_box.list2.value;
0 x) j+ y0 W' K# y9 o }0 j8 u: `1 E4 i3 X+ _& [
if(val.charat(0)==","){& \6 W' C' {; q0 s
val=val.substr(1,val.length);
5 q9 C6 K- c, F# |( i3 E4 t$ N }$ `+ C7 P) Q+ ^* P# G
opener.form1.frecname.value=val;
0 i" d2 c! f; f b( i% |: R self.close();# G5 p( t2 J/ O/ k* C
}: S9 a' d# p) U) @. E# M/ U
//-->
* z U: x: l8 R/ P</script>5 A4 Y: M0 x* m0 o
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">; F. U) P. k3 ~& O2 M. s, R% H7 b
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
5 f9 Q) P2 W" W* Q<%: i2 R0 w8 o# f/ W, p
cdatasource ds=new cdatasource(); //数据联结bean实例
) o' `: c6 l! X- v5 J4 B6 x java.sql.connection conn=ds.getconnection();
0 ]# r/ b" }, Y8 z9 O java.sql.statement stmt=null;
" ]$ U! u0 x8 k/ t% j( d java.sql.resultset rs=null;, d. K* m4 `0 _# s3 K
cdatacheck dc=new cdatacheck();
: @" `& }# L' V9 W P%>$ i* Q& f" U8 ^
<%5 O; W! W& _& {( ?% d( z
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";
% s# W) s' S/ d' [6 n9 o& T$ bstmt=conn.createstatement();9 f, k9 M) Y; D3 j8 c" a4 T
rs=stmt.executequery(sqlu);
+ O/ F/ b: G6 }1 C, n# h+ g%>- p: J/ ]$ ]6 L- p6 k$ G$ r
<script language='javascript'>" d, G$ j& [$ l5 o5 S2 X
arr = new array();
% I6 [$ t( H. H2 W9 g q- t<% int temp=0;
# u8 g, J3 U& Swhile(rs.next())
' U2 B7 w- ~, [& w3 b6 G1 Y{( N2 F, f7 U9 \: _' F# J6 N' D5 _2 Y
%>
9 P- _! J& E3 _6 E" M; l6 k" Narr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");8 i9 { H* J' x4 x ]9 B4 I
<%# H6 W8 V7 \5 |# c4 o
temp = temp + 1;
, J$ t) c% w. Z1 P3 G; t" k}9 p- A+ G- p2 W6 ^4 O% d' O8 R
%># e4 [/ p. P- F
temp=<%=temp%>;
& o7 l; @) T0 N; [function changelocation(id){ + R" U. q! h$ L3 K3 l# b, F: z
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
* j! c, O3 r" q8 k% s; M6 u8 Svar i = 0;
4 x' X, ]4 V: y* o |$ r; b* }$ S: vdocument.combo_box.city.options[0]=new option('-------',''); 6 G$ d; Z- z7 f
for(i=0;i<temp;i++){
& h" @; [/ O( [5 R% `if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
) { k6 V6 B& F' Gdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
+ J3 F6 w" D/ n a" v9 S} 0 H! e4 m4 t$ j( b% [1 B: z1 e
} 4 u+ f5 U) E n9 F+ W t. r1 l; d3 @
}
" e- X( P: A6 ~3 B" Z& A& I. X- U</script>1 Y4 r1 s! _- }6 ]" Q
3 X0 h' t7 C. X4 c0 h6 w<form name="combo_box">
: M; M" f+ {2 e4 a2 _7 |<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">, x5 `1 d- @$ {2 e) A' c
<tr height="24">
9 u. a$ T# w9 g <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
- S$ d4 d6 \5 H2 H( B. J9 K* \) ^ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
) n5 }$ h* _7 P* v1 b u3 ~ <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>0 O) m% i, H/ O+ N! E. j
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
# T8 n* T1 l3 F$ o </tr>( j- v" h' C$ s9 B
<tr>
( }7 O% w3 U7 L. r2 b9 s0 k' f# F <td>
* d* Z" R Z6 l. T <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">: p6 X+ Y8 c C
<option value="0">请选择部门 ---></option>6 H) \1 E" s! z& c/ A: [1 `
<%
7 e' M; N/ s6 y/ N' q string sqld="select * from tdept";% h, R/ u* ?& c% a
stmt=conn.createstatement();3 N* I% Q* C' h- I$ l" m; l
rs=stmt.executequery(sqld);# g3 S2 [7 G3 j
while(rs.next())
g! Y+ c. j. k{% z/ D! l+ k$ E8 _" L6 {
%>! J* m9 ?6 l8 g7 B u8 x
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>2 L3 A3 q h5 ~
<%/ f) |/ {+ b7 G' y
}
6 I5 h0 q1 a5 M" G%> " ?: P( g+ u2 }8 W* r3 z% c$ P2 c
</select>0 c: E. ?1 u; k0 J% y7 e) D' V
</td>$ N8 n4 s6 { Z$ B) o- `8 f
<td>6 ]* i7 K8 Q. b6 w7 d9 N: @* R
<select multiple id=city style="width:150;height:200" class="bgc">. E. }* S3 u8 ~) v: ^
</select>
3 C. n$ y3 a; a</td>
) b9 m: x# ]. I+ s% T) N" W <td nowrap align="center" class="bgc">% h$ m6 [) {* n0 i2 I* B, H
<input type="button" value="<<" class="buttons">
9 l* E; ?( d9 d: |6 G <input type="button" value=">>" class="buttons">% h0 b, _3 O' I+ u8 [
</td>
. Q/ V% a3 d/ E- c: _ <td>
8 E! {7 Q0 H- W5 }- m) K% b- p <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">% O7 [ e- `! M+ N {3 l2 [
</select>
|! i' u/ {1 }8 m$ V. W) b</td>
8 R+ _5 z( U$ j4 l, Z0 I3 W5 T! {! g </tr>% x: `9 a! j3 m% l0 _
<tr class="bgc"> ) ~" Z1 T6 P, B; u! n5 G6 w" j
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
: M) O) f* S* h1 u6 @ </tr>, s/ j& k9 Q) }+ ?* I: c% V( N8 {
</table>
0 k+ w6 E3 j4 O</form>- @2 d! C5 \1 f
<script language="javascript">' A8 I [; Y F/ @
//人名移动 v) C/ k$ w- u
function move(fbox, tbox) {
1 w2 m6 p9 y" z% pvar arrfbox = new array();! M' y/ D; V* u5 {5 ^5 M( X6 Y
var arrtbox = new array();
- h# s5 _, G" V' N0 {8 E: Lvar arrlookup = new array();' N, d z' Q# {: a3 a/ ?/ p
var i;
9 g- E! \% k- Zfor (i = 0; i < tbox.options.length; i++) {8 J* q1 v& _. u' a
arrlookup[tbox.options.text] = tbox.options.value;
. ]/ j! F7 b1 f7 n- iarrtbox = tbox.options.text;
( j% W; d3 I) c- j}$ I7 w; {- K; k) _
var flength = 0;
/ I# y, Z! Y! `) N9 L" w5 Nvar tlength = arrtbox.length; w3 C6 L# b) W- P- _/ P; O
for(i = 0; i < fbox.options.length; i++) {% f* R! @5 f: B9 A
arrlookup[fbox.options.text] = fbox.options.value;
: q0 z: q5 H/ g# W! zif (fbox.options.selected && fbox.options.value != "") {
# Q* ^0 V3 r9 @2 l( o6 D% ?' J7 uarrtbox[tlength] = fbox.options.text;
5 o# o; ]) C+ Ltlength++;1 w! {* b: f4 P, ?9 T
}4 E% t' i( e- c$ m% J1 w' s
else {
3 P% N4 y: n: Farrfbox[flength] = fbox.options.text;
% d t5 O4 ^1 Y+ O# Lflength++;
6 c$ p! I6 ~. M+ A: L! j: u }/ w/ {& r3 P! A: a. N$ l
}' ]6 Y( G+ x v1 d: |( H5 X8 Z1 v
arrfbox.sort();
. `8 p+ L4 S( v8 K9 L4 earrtbox.sort();2 }% ~/ S% m6 B, { L6 Q
# E. f6 I( y1 `- `0 Nfbox.length = 0;0 I2 J. `8 c y$ a& I4 G) R
tbox.length = 0;& l% r- }7 v+ {
var c;
1 D, G$ @' E, \$ f( Wfor(c = 0; c < arrfbox.length; c++) {
5 g; l# o3 v3 b. x5 svar no = new option();
: j* P0 R8 f7 q/ e2 V; yno.value = arrlookup[arrfbox[c]];
1 \! A( V7 B, k+ Rno.text = arrfbox[c];
* X! p, W+ d. G8 c0 cfbox[c] = no;
" E# k' w; }( {/ z; I: i}
3 u. p& k5 F+ u- v4 Zfor(c = 0; c < arrtbox.length; c++) {
, ]9 |) n. t) e2 k( evar no = new option();
$ L+ o l# _$ T" e. M; v9 rno.value = arrlookup[arrtbox[c]];; ?8 G* r. Y, H) @9 A+ A
no.text = arrtbox[c];
$ F1 |- h. ]% p9 |/ y9 Z6 b* Ltbox[c] = no;
4 x4 c* ]' V# j; X- G5 q }
1 D1 I3 k; u2 P4 `}1 j0 \! M, O3 O0 F5 ]
</script>
6 U/ T) m3 N' |</body>3 d! T, y5 o, D0 R
|
|