  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14221
- 金币
- 2401
- 威望
- 1647
- 贡献
- 1349
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
7 K! k; o; _ z$ }4 V- [ c pageencoding="gb2312"
" @7 v$ s9 ]4 ?- ^* |7 |0 K- g%>2 A9 G k4 x8 f! z0 S; ?
<style>
. r# r# s: \* [+ U.f9{ font-size:9pt; }# @: T- C8 d2 c: B' s. F
.bgc{ background-color:#aecaf9; color: #0033ff }8 s! J/ @, `+ C. Z6 y
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
( @$ ?& `& e5 X; P6 |) t- w border-bottom: solid 1px #4e7dc1;- x- z/ Y i0 v' x8 g
border-left: solid 1px #aecaf9;' x9 E, E" B) z. T V+ p
border-right: solid 1px #5679bd;
/ v& ?, B, x8 u padding:1px;
- D; v3 r/ p& k" b S: C margin:0px;}& t2 z7 A [; l6 l+ A% ?" q3 F
</style>
6 X, G5 i9 {# M1 y! s: l<script language="javascript">4 E: m. \; F9 x* @
<!--
! G; R4 k: c. v5 }# s; A" ?# L) e4 jfunction rv()
* `6 l' G5 b% }9 \- V{
/ ?* X' A! A- F7 i var val="";
+ q! `. b4 Z8 V1 Q$ s# }) n for(i=0;i<combo_box.list2.length;i++){6 J; C- W9 Y4 e2 p% N
val+=","+combo_box.list2.value;7 S$ o/ p- B1 ~! V: p! r
}
7 ?7 y4 p/ p. m if(val.charat(0)==","){+ w9 ^% ~! m4 e
val=val.substr(1,val.length);# w/ ~4 w. @9 } ~. R5 g
}
. Y" D4 b2 U: {* ^ opener.form1.frecname.value=val;4 K. r. L* o9 c7 ?# c9 w
self.close();
5 Z. q* m8 x8 t}
9 s" `, _; L2 \6 U1 B//-->
% A8 ^' T! g1 e! I I2 S</script>
J+ c7 m( i. N; R9 S$ d' u<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> _( r7 S/ g+ e0 O. k- B) m ~" k( r
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />3 u2 i& G7 r! g5 M R
<%7 o+ W6 n3 e% W- T5 B
cdatasource ds=new cdatasource(); //数据联结bean实例
# |# V( z4 N* W/ P5 n6 e java.sql.connection conn=ds.getconnection();# {( x* d4 q2 |, f; x* I
java.sql.statement stmt=null;
8 ~2 V. Z% {' B java.sql.resultset rs=null;
d! v4 b3 x" {( b$ L cdatacheck dc=new cdatacheck();
3 V! s* X* y. q) H. O& E%>
: o3 E# B8 w, v<%/ R$ H: x1 H/ g% D1 A
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";# A/ |( i8 B# ?7 H# `; l
stmt=conn.createstatement();: u |: y* _' y& z' ^- Y2 V
rs=stmt.executequery(sqlu);
3 m! x8 y3 ]$ |( @8 g% I%>
0 D' ]8 W0 [. W& |<script language='javascript'>
" c+ b/ A: ]* X3 Oarr = new array();
/ M/ G$ o$ J/ i2 T2 h<% int temp=0;
, m$ Z. N* g8 x* A" \, ?$ m# Uwhile(rs.next())! L/ {9 }' v" R. C0 D
{2 w5 E7 c: @% J- W7 v
%>* g8 {3 U, n8 U. o ~0 q
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");8 d" w! G2 i9 ~2 ]2 S
<%
* r: y0 h% R& Z0 b1 K/ C) Ztemp = temp + 1;% Y% H$ [3 f9 x
}
7 Y7 b$ A0 C$ j4 j: p$ `5 ^% d% m%>% U& G& T6 J- i7 X6 r
temp=<%=temp%>;
5 U+ E" T6 u5 _, V6 \8 c# rfunction changelocation(id){
9 N) t* {( o" h- Ddocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 x/ [4 `( t- x# J4 r
var i = 0; : e4 W+ u: z0 w" W/ M Z- T5 A
document.combo_box.city.options[0]=new option('-------',''); & }" K' ~+ j/ Y% v S* v/ |
for(i=0;i<temp;i++){
- a6 V4 h( `: x+ d6 H+ hif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] . K, [7 a. e1 i2 R
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
2 ?5 N2 J% |% O}
0 _/ e- T- p- z) |9 c* A} ! H9 Q4 l5 _4 |9 e# L/ t4 E
} G, m H3 z8 G" ?+ F) n
</script>0 m' E1 q. X6 b7 e+ R
; O$ C: C4 Z# I/ p+ X9 p<form name="combo_box">+ y7 g) d" c1 @. q1 r# u" D
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
5 @/ \. Q5 m# J |/ ` <tr height="24">
" k; X- B1 [. I. m4 K0 ~ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
( b3 S& J6 D0 Z4 e* X- P6 _' a <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
8 Z, }0 F9 L( S1 n8 Y <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
' Y3 E) Z/ x5 S8 b" l6 N <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
, }4 W: k$ j5 b </tr>
; ?0 c4 m" D7 _/ @2 Y <tr>
6 Z5 \, h3 n$ a0 m: d <td>+ b' r4 V. M5 S1 `3 W1 H7 N; T
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">, A0 H7 i% _- Q; O5 m3 R, F1 d
<option value="0">请选择部门 ---></option>* F. T `/ s5 C) k" r
<%( R; b( |8 `' _( {; J
string sqld="select * from tdept";( h' G; m0 c( f
stmt=conn.createstatement();
1 l% {- l+ w1 d: \9 Drs=stmt.executequery(sqld);
d8 t3 P9 @# i* t. {7 a% u, w9 awhile(rs.next()), _' K. E- d' `7 {
{
$ X' s4 w) w* C& j- v: X%>+ x2 [- ^& E# O
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
0 H1 V7 ~) ?( b6 A# H5 C<%
% i' Y: C) O2 _}0 |# q0 {- }* @' N9 Y
%>
4 Z; U- s" A% g. G* d0 Q7 I, _$ N </select>! [; c1 j6 C( h4 F3 _- W
</td>: W8 V/ K8 C2 {& W _+ ~; K
<td>+ Q# E+ `7 |9 ^5 P* a5 r* Q1 S4 H1 P
<select multiple id=city style="width:150;height:200" class="bgc">: u. d( W1 G) F1 n1 q! K
</select>
) `. n! }& Y& _ ?</td>' M2 K. a8 Z9 | ~$ r6 N
<td nowrap align="center" class="bgc">
* k% e7 Y7 F7 |3 Q& a- K0 a <input type="button" value="<<" class="buttons">
8 [7 {$ H2 C- T& Y3 A6 Y& [7 d <input type="button" value=">>" class="buttons">
9 j% h1 Q( C8 v5 k( Y6 Q$ `! P+ B</td>
$ X$ m" N: E* @ <td>8 T* O2 q' r2 g( B; `, ]8 q
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
- ~% K$ b: z/ A1 N6 N: Z+ w </select>' C; [5 i# w$ a7 K+ |
</td>! P. ^7 t" d) `7 ~4 B* t
</tr>" t1 A" ^: Q6 _* c
<tr class="bgc"> 8 K! X2 D7 [: o$ B! g
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
6 e2 u/ F S [* Y7 ^( m( A, k </tr>" W% p( o3 ~. X, U4 U9 G8 _8 a9 y. K
</table>
$ h- Y5 P5 k. E2 ~2 i! R</form>
0 t) P& a3 |6 d2 ?<script language="javascript">
$ m/ k5 ?+ f& k( `/ o$ _//人名移动
4 I3 I5 L( A4 ]% F3 `6 y: Kfunction move(fbox, tbox) {' `! c0 k% s1 q: E- {* \
var arrfbox = new array();( C5 L9 c% J7 r( ?
var arrtbox = new array();& `7 E# E6 y& K% j4 N8 w9 A1 N
var arrlookup = new array();
. o$ v0 _# y! {7 t+ ivar i;
2 t& p+ h8 [; c5 E# D/ V7 N/ k) Xfor (i = 0; i < tbox.options.length; i++) {2 O0 f6 O/ n0 h% C$ |
arrlookup[tbox.options.text] = tbox.options.value;
; W5 T/ x1 _9 d9 q4 w8 \0 W" W4 D& karrtbox = tbox.options.text;
% n5 Y" {' X) q! F9 m. n+ p# A0 q8 S}0 Y a) a: t, \( e
var flength = 0;
* N) F& ?: N# q5 K; fvar tlength = arrtbox.length;
$ z: D, N' a$ c# O( Yfor(i = 0; i < fbox.options.length; i++) {( Q6 k8 \- L7 \* p! ]
arrlookup[fbox.options.text] = fbox.options.value;, e' q o! X, d$ R5 X& u8 ]; t y) `
if (fbox.options.selected && fbox.options.value != "") {/ }: P# \! Y- S5 W/ n" l: k/ y
arrtbox[tlength] = fbox.options.text;
& [! k# d! y) K7 H' ?% Y2 k9 ~* g" Itlength++;
+ d7 F0 J$ K- I; h/ x}
' {& ]4 a v0 V! `) Melse {# ^' T( D( ?# _& c
arrfbox[flength] = fbox.options.text;$ e' B/ C' n0 v' U5 F1 r( C
flength++;
( A4 @5 M2 T3 ~% g }
1 u8 Q2 [( M; m4 Q: ~6 y4 g}0 m# V% Z2 N) W
arrfbox.sort();4 Q* m9 `4 @! D2 Q1 R2 _
arrtbox.sort();# ? H* x0 H1 S2 u4 _) n
0 ?! p/ l5 O! n
fbox.length = 0;
! N! C4 `* j6 w2 O, d( v9 Mtbox.length = 0;
S/ ~0 Y8 `& b" u% L% svar c;
+ U4 t+ Q9 U* [8 ~. S9 q$ Sfor(c = 0; c < arrfbox.length; c++) {
0 k# \: t# ^, F H. y) \var no = new option();* J7 A! ~! X2 X% j+ B8 E8 y" J
no.value = arrlookup[arrfbox[c]];
8 _' }6 _! M$ Nno.text = arrfbox[c];6 y1 N- l# j& W
fbox[c] = no;
- k8 L, V H% E, z}
. ]8 c& o. K8 X/ f. w, Dfor(c = 0; c < arrtbox.length; c++) {3 w0 R6 l( \2 S: Z! n! ?- x$ S
var no = new option();
+ l5 j& X6 W" m' Dno.value = arrlookup[arrtbox[c]];" D5 K4 T* ~* U, o B& E7 t3 Z* E+ s
no.text = arrtbox[c];/ p5 Z4 P+ T' h3 w( @, t, j S
tbox[c] = no;% |: o& t. w, {1 v$ c4 e
}
0 p6 ~+ m% D" J' d7 W* t}
' T: W% C# T M3 N</script>6 } T" j; ^% u$ o0 |1 \
</body>
7 e; h, t$ h y7 n' l6 I+ L4 O |
|