  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14191
- 金币
- 2386
- 威望
- 1647
- 贡献
- 1334
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
5 K4 U; N+ H5 o: K" c c pageencoding="gb2312"2 V4 X8 \0 @2 h5 e: z& {
%>
* o. ^# i! R v7 ~1 }1 C1 t; f7 ]<style>! t8 d3 i1 C( @5 D( f/ x
.f9{ font-size:9pt; }
7 p$ w7 D, @% q [.bgc{ background-color:#aecaf9; color: #0033ff }8 p& U! Y: F0 Z. o3 u }
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;6 s1 c: m" _0 X- F4 _
border-bottom: solid 1px #4e7dc1;
' j( [ T( v) F4 g- B border-left: solid 1px #aecaf9;
) p5 c7 {' {7 P8 v- z border-right: solid 1px #5679bd;# A* V e' V; o8 }0 Z4 y5 I; f
padding:1px;
7 }' [$ V: }9 P" V' a margin:0px;}
* b) G: F( k' o) S2 {- Y</style>
. p' R: B/ Q/ ?3 E/ h<script language="javascript">2 |8 }# ^4 K' C; M8 {+ g/ }1 @
<!--4 U3 ]; T5 s9 p A& G; Z3 h( v* _! s; S5 n
function rv()
& q" H* S" u; r5 ^{
! R. z& r$ [, y. ?1 k8 Y var val="";( q- z+ b& I, ?
for(i=0;i<combo_box.list2.length;i++){- {7 |3 J; u) E9 E. f9 g# `
val+=","+combo_box.list2.value;
& j/ W7 ^; N! r) N }" C+ w# o" O7 U+ }/ S1 c
if(val.charat(0)==","){4 A K; y+ t" c; }8 P
val=val.substr(1,val.length);% d B9 L+ W' H
}- ]( f- ?5 I2 \
opener.form1.frecname.value=val;
' U1 R7 X8 p' q5 d3 j; ]$ ?: @+ `' P self.close();
5 G5 t! b# W" D4 x, v7 ?}) n9 ~ S C& m0 T; |( i3 T7 W
//-->
2 q& L3 f q) B' g4 D: R- m) A6 \+ ~</script>/ B9 d% i( W1 |; g, K
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> A$ E p$ K& X, h+ u0 d0 |
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />2 h. o( @9 M# }7 ^
<%) g( L+ B. [) X C0 [7 y4 g5 k
cdatasource ds=new cdatasource(); //数据联结bean实例
+ T) V+ N# v9 `) j; _ java.sql.connection conn=ds.getconnection();% ]" x% O0 i; _% V1 p
java.sql.statement stmt=null;
& i6 N8 n/ q) L" | s4 H java.sql.resultset rs=null; |2 F+ N6 c9 L/ T' z' Z/ E
cdatacheck dc=new cdatacheck();
3 F% O& h- M6 [8 M) i%>: o w% l5 X) J b, w6 M
<% s# }8 ^" n$ q9 }( [
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- `8 e5 E0 u E/ M
stmt=conn.createstatement();# _: P4 n( a2 X0 L" e! y1 e: Q# Y8 @$ Q
rs=stmt.executequery(sqlu);5 R$ C$ s) h0 Q- D) s
%>
* a, K1 h O( r$ g<script language='javascript'>! d @* q l, y6 }9 g4 X
arr = new array();
- }" p' o& J! T8 Z9 R2 L<% int temp=0;! B2 N. Z" l% v* r# i! R
while(rs.next())
0 l1 `+ x! P7 F7 @5 {2 V7 l7 `& { F{
" E. B$ }3 H' r F7 S% r%>
) k% f+ h, m+ rarr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");. Z2 v8 F$ U/ K' ~1 [' H* X
<%
2 p' x; F# n Q* `. Z% z9 Y6 _temp = temp + 1;( r* v" y0 x9 D: r1 {
}
( e8 L4 a6 h+ `2 A. r& u( n%>( B, w5 z3 t q# T
temp=<%=temp%>;0 ^- [5 Z; F& U3 u8 z
function changelocation(id){
; _6 l9 w2 o- L7 v' hdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
/ l/ A8 G6 J8 nvar i = 0;
# `- P* U% z5 k5 S* A' }document.combo_box.city.options[0]=new option('-------','');
K9 m, n' X8 Efor(i=0;i<temp;i++){ " |/ m$ L' t( |/ ^1 Y! |/ ~ R7 _
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] $ D O9 J: c8 |7 o& q
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); , ^ W9 B* ]; t" }8 R4 w
}
b }- m o3 Z0 F: z4 A}
1 n! H: [& `" R* i- T+ ]2 T* j1 p}
3 T o O6 ]0 b8 M# |' H t0 _2 M</script>7 ~' N6 e' P# j2 I2 H
_; d! I; D5 _2 L1 ], s$ \6 Z: K
<form name="combo_box">
9 _& J, e" s7 J* D& G1 y+ c1 ^. |<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
: G# }5 V/ x: K# l" X* \. U <tr height="24">
4 t" u* Z, D7 N <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>. ]+ c' ~- p. T9 o, F3 G; b' d
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
) K- `4 v* O+ M0 ~& ^+ s# d <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
# e1 b d" @2 k2 z3 K8 w2 S# V7 E <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
4 ^+ F, F" |- v0 s2 @* _ </tr>% P/ u2 G8 t5 }" T+ s) b
<tr>
% V/ t% ^( _5 s. a4 k1 u6 I <td>
( ]- a% Z: i# h5 u5 [ <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
$ C- A& w9 _' `5 s. E7 x6 i7 t <option value="0">请选择部门 ---></option>
0 B+ h7 b' k6 I4 l* d* h9 j# p<%
_$ C# m( W+ J* q string sqld="select * from tdept";, z( z6 J6 h" |( e& @1 `4 x
stmt=conn.createstatement();
1 U2 C6 `( h% V8 M& Prs=stmt.executequery(sqld);
) G0 }; H! r$ |1 ywhile(rs.next())$ w. z+ S; t1 H8 X) T! U' b
{
9 ~: H; H- }/ i4 q, ?%>
4 G8 Y) L {2 E0 G <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>* u% s2 J! e5 z* I8 a
<%* \& e# N. ~/ \$ i% X
}
0 h% r; H" E# z$ X9 j7 a%> ! n; {# W! \2 ^
</select>" A& P! ~. V x& ?9 I9 f
</td>. n4 o& h: D( N" ^2 W: x
<td>
% R9 Z+ U3 U+ ?) {5 Z! a# ]$ l <select multiple id=city style="width:150;height:200" class="bgc">
5 a" o( c* G$ D$ h </select>
' M1 P: @9 s% A, V</td>$ z- g) s* k. i, M6 B
<td nowrap align="center" class="bgc">3 Q; G# R8 R+ F" {
<input type="button" value="<<" class="buttons">
$ g* K! x3 {; M! U% l <input type="button" value=">>" class="buttons"># l8 B: ?. [+ S% B, q- D& _- Z$ j
</td>% t* [+ _( {! r8 t4 u
<td> @& X8 ~) y% v& V+ C7 k7 H6 a
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">3 b- m* d8 n+ u$ M& f
</select>) j, G, f; Q2 W1 i4 _, V
</td>- ^! X; U* Q. B
</tr>( [8 |0 f0 @: L( Q
<tr class="bgc">
9 M! R: t6 x+ W <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
P. v! I$ \) K </tr>
# d B& `* u0 M( g- A) R/ y</table>( U2 }) i' n3 G9 q+ [& u3 g/ ~
</form>
; t2 `; ~- v& x0 k( R<script language="javascript">' S0 _5 C, R/ U) u( q2 {
//人名移动( {* `3 b, C. [0 s+ _/ c) A
function move(fbox, tbox) {& {/ z, n/ x% F- H- @; a
var arrfbox = new array();7 a$ p1 ? }6 m% }0 i
var arrtbox = new array();2 e+ a, `/ z, x, z) y0 C5 Z$ O) a
var arrlookup = new array();' j/ \' O: @8 Y( ]; p
var i;: q; r0 K3 }- `) s$ P' b
for (i = 0; i < tbox.options.length; i++) {' l3 {8 j9 X0 ~ b3 `; a6 |
arrlookup[tbox.options.text] = tbox.options.value;- h" x+ a) F$ P+ A9 ^4 [) h) W
arrtbox = tbox.options.text;
1 z' w. y7 O' p; N# h; X4 \}
! n5 z% \. q% B/ Y0 Ovar flength = 0;
: s; C8 e- p+ l; J3 ?8 l* }var tlength = arrtbox.length;
8 ^6 _3 U5 y+ W" G) ]for(i = 0; i < fbox.options.length; i++) {
[" J2 I7 S. m( barrlookup[fbox.options.text] = fbox.options.value;
, k8 i4 S2 u. g( ~8 E3 X1 i+ Uif (fbox.options.selected && fbox.options.value != "") {
8 |/ }* ~" v" darrtbox[tlength] = fbox.options.text;8 j9 P- L- }6 p! J
tlength++;
$ G) `. `: T' D" z}1 f6 n* x; j9 k5 Y
else {5 s8 T# e# s' F8 n
arrfbox[flength] = fbox.options.text;0 O0 ~- `& ]% X) A; m
flength++;
( U2 t" W* I/ t* Y* j( S# Z, j! c' ^4 r }
9 k/ I8 n& [$ R* c6 v}+ Z' w7 }8 O t+ V* K O
arrfbox.sort();
; ~8 ^" D: b& h; L3 p% harrtbox.sort();
: {3 f& r" Z7 H/ J0 s# i3 d; T9 e* ]) \* ?
fbox.length = 0;
! |: s# K+ o+ U8 Q1 p; V: d# A( l/ etbox.length = 0;
9 F ]4 e& x* o; o6 evar c;
' ^( i* J: B4 x `3 V5 `for(c = 0; c < arrfbox.length; c++) {6 F ~/ t4 ?7 o/ d1 k! o* S
var no = new option();$ u) w0 g" q1 c0 S7 `) \
no.value = arrlookup[arrfbox[c]];
) I# I( b! w$ r& u5 W# e' E; h. Mno.text = arrfbox[c]; @. O' f* l- j* ~) A6 w( {0 S$ |
fbox[c] = no;& p0 C9 H! j+ ?; O4 H
}7 _1 n/ V- u# d3 D: G, v# d
for(c = 0; c < arrtbox.length; c++) {) w# |8 h: p' L2 k: W4 C$ S
var no = new option();6 o2 n! T0 W3 I6 f' j3 U0 G( r" H! [
no.value = arrlookup[arrtbox[c]];
9 t6 x; D( A6 H+ A7 c0 N2 ano.text = arrtbox[c];
B* r+ ~% @) h& d4 W1 otbox[c] = no;
9 K5 ?; Q- ]2 @ Z( `3 z& ?* y3 W }
6 B& N5 i2 `) ~$ r8 t! }}
9 Z4 w% A+ |4 A6 l V! Z</script>
5 Y9 p) ?( S$ ^; \" S</body>+ e( S6 w, o N* k ?2 V2 v, d
|
|