  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14221
- 金币
- 2401
- 威望
- 1647
- 贡献
- 1349
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;", D- s3 d( W0 `% t
c pageencoding="gb2312"% n) d- M' @2 `! s
%>6 ^4 V |4 `* n8 O$ l
<style>0 T3 e# L3 b4 z' I: C6 j) o3 s
.f9{ font-size:9pt; }7 w) N3 f/ ?0 g9 Z& e t8 G I
.bgc{ background-color:#aecaf9; color: #0033ff }" p7 N3 z7 [( A$ m0 j" _( x ]
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
5 A3 f3 j. ~9 o/ F border-bottom: solid 1px #4e7dc1;$ p/ e+ _/ b) {2 A5 t) U2 h2 j- L
border-left: solid 1px #aecaf9;+ ]. g8 g7 k# Q" k! _
border-right: solid 1px #5679bd;* s1 Y. d- N* M; l& q" v
padding:1px;% o8 m9 ] i/ \/ z6 u
margin:0px;}0 N7 D' b% Z4 \" b8 {/ R8 w
</style>! {$ y- T; I4 {. E* g
<script language="javascript">2 D' c/ t' ^+ A0 W+ r2 r% E
<!--5 o1 o" X' o: ~* c8 F
function rv()
% W$ K |3 g6 G) L% T6 M{3 G4 r G6 y6 j3 N. L/ E h
var val="";
Q. Y( P( K$ X* f( }, c for(i=0;i<combo_box.list2.length;i++){$ e1 W* p. I7 F0 ]' @1 e T$ F
val+=","+combo_box.list2.value;
* Q8 y: B0 R- ?7 ]3 k }* ?/ ]% g, J( ]4 r C$ H; j$ R0 ^
if(val.charat(0)==","){
% a4 o/ |1 l) g0 s# {; m( K val=val.substr(1,val.length);! i. u* m9 }/ ^$ m, k \9 `" X
}
6 y- ~ f, p" @3 Y* _' r+ _' I opener.form1.frecname.value=val;) d+ X k7 @4 Y
self.close();
) X8 u3 M9 B/ x}
4 W* Q ^5 R- W9 ~* K//-->
$ n2 I. U; X% g! j</script>% f, G% h; X, u% i$ O5 }8 e" O
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">8 N: d+ L9 k$ S+ X! O, L2 g
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
$ m. F2 ~ c8 H$ f<%
+ k: O" u4 C! Q$ ^/ z$ Q: J+ T6 _" X cdatasource ds=new cdatasource(); //数据联结bean实例7 i! E) j# k6 e
java.sql.connection conn=ds.getconnection();
1 B: V. h" Y% x% y# F java.sql.statement stmt=null;
% e4 P% j" G) g ^/ F6 v# X! r java.sql.resultset rs=null;
1 p1 B8 N6 t! ^- F) b9 b cdatacheck dc=new cdatacheck();
# m1 e( K! j8 ]# a' p. s; m6 A%>
% g$ s! ~8 U# T9 M8 K* [3 t<%
3 J1 W% ]! t$ F# mstring 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";
7 _% ~/ I% X Ostmt=conn.createstatement();6 K z9 O' p$ O
rs=stmt.executequery(sqlu);2 W/ _8 c0 i3 R5 R+ s5 |" a# g
%>
0 ~$ N- M. h; R<script language='javascript'>, z$ ]& T. {* x( r8 Q
arr = new array();6 J: `5 ~& @- Y. X6 I
<% int temp=0;# @1 A! e2 Z- T9 U
while(rs.next())* W6 B9 ]( P- ]4 N. ^* P' e# }
{$ ?( }: l- C3 X1 H9 [
%>8 t: _9 J# g6 F+ V' B
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
7 P6 \4 k8 I4 m: t5 k# q, _<%
# t% }& h0 ^" xtemp = temp + 1;* b0 c5 A7 ^* I. S; v
}
# ?' @5 s6 g( ?%>
( D! H+ f9 l/ F* `- K0 ltemp=<%=temp%>;8 j. I% }2 g9 R1 i5 h5 A4 b
function changelocation(id){
! ?) Z0 ~7 t1 d$ m8 Y& f& I$ w3 c; x0 idocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
7 }# K2 H+ K. l& Mvar i = 0; ) H/ g, D7 p' c7 r/ o6 J
document.combo_box.city.options[0]=new option('-------',''); ; b1 c& h. h2 W# {
for(i=0;i<temp;i++){ T$ L! X0 N0 w
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
) t4 [' a2 {! N1 j/ Bdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); . X: V+ P: @; e; v& B
} 4 ]9 v; f. y. J9 F1 j8 E
} 6 }+ b/ i9 M5 I' n
}
$ _, M$ f7 }! g( {! {</script>
S+ S- r. e C$ k/ `) c% \; O. X" _$ x) ]
<form name="combo_box">" q* b/ }) ]% Q0 Z
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
& A( N1 y2 H2 G <tr height="24">
! N+ j/ p! D$ E0 |; e4 X <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
, {4 ~( f5 Q7 r) s! w' F+ q# [ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
1 L2 f2 {1 U ] <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
& l' ^. i2 O, k: `% s6 R$ }; ? <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
0 [; `/ j% B3 ]3 } G7 \5 q9 \( p </tr>
5 S0 E; v) ]5 r3 ` <tr>
6 L) y y4 H3 L( d; ~* i <td>
, M X4 f% ?- H. {9 o* A9 { <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
/ Q5 U: J+ `/ W9 R& G# m5 h* R; z <option value="0">请选择部门 ---></option>
& S+ P0 |4 K$ c5 h<%
|( U* t1 f) @6 u string sqld="select * from tdept";
4 x/ O6 v! z; ostmt=conn.createstatement();3 X0 o$ h* ^+ J4 L
rs=stmt.executequery(sqld);: j. z. y& Y$ {! w% A: t- G
while(rs.next()), C' E6 b# m% k( F" a0 K" h* _
{
1 w" Q. J }" K/ L. y# S! j& ], V%>
+ R+ b2 U+ X2 b <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>6 H: q5 K; @- d, |8 P& M
<%- m3 ^+ }, L0 d
}
$ \ w) |# }2 D$ l$ k X' ~%>
, h# g: a# E+ m; |' k9 U9 _ </select>+ U3 q1 [: k! a4 B5 G/ {
</td>6 n+ N' g1 Q' h
<td>% z5 ^! n' X4 B, o$ u; `1 N. W
<select multiple id=city style="width:150;height:200" class="bgc">
6 o" J' P2 v% `, V5 Z( N! ` </select>
& h. a- l# Z7 A* F</td>1 b+ G' `7 d# q2 |
<td nowrap align="center" class="bgc"># ?1 [, c. k% W2 E2 a
<input type="button" value="<<" class="buttons">
% _/ w! P* j6 Q. _7 J1 o* b <input type="button" value=">>" class="buttons">) h5 k n4 b3 x" J
</td>
3 b2 ]8 H( Q( [7 n5 _ <td>
4 G! `1 r% q& I T4 |# Y- s; Z <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">3 f4 P: t8 N4 ^3 l8 ~4 l
</select>) P- K2 q, \4 ?) W. q
</td>2 b! |' D- S! r7 r( h* f4 P; j
</tr>) e/ o. `, [5 f/ m
<tr class="bgc">
. x1 a! K: g. n3 f3 d <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
9 A$ T/ L. }+ u2 H# O </tr> D* i( u: ^! z
</table>8 u: m2 r0 R4 P u" Y
</form>
V* a/ O# ^% Q0 |( ]1 s! x<script language="javascript">- q, N. X2 L- W9 Q+ n9 L/ Z
//人名移动
/ z0 B9 f% @$ @& {function move(fbox, tbox) {
* }# e8 N; T, a0 o) O3 Pvar arrfbox = new array();7 t5 |6 |' I! s
var arrtbox = new array();9 d1 q, q/ Q3 s# l6 ~. R" Z& k7 r
var arrlookup = new array();
- N: M; {7 Y8 A- Dvar i;' t/ ~3 T% ]: D5 ~# l$ V1 A! ~, F' B
for (i = 0; i < tbox.options.length; i++) {- D/ x) E1 F3 m
arrlookup[tbox.options.text] = tbox.options.value;. u2 l7 U9 h5 v
arrtbox = tbox.options.text;
5 s; q% B1 Y9 E4 P6 e9 g}
R+ Q( l$ v" f7 u1 p6 B: Yvar flength = 0;
" v w* p7 w# l$ {+ Fvar tlength = arrtbox.length;/ X1 u0 o% o* v4 R8 c
for(i = 0; i < fbox.options.length; i++) {
) t9 M- Y- \# p! V" c: a+ q' uarrlookup[fbox.options.text] = fbox.options.value;% [) w" E* _( @6 y# g' o
if (fbox.options.selected && fbox.options.value != "") {5 B: X' q0 p+ W: x, Z
arrtbox[tlength] = fbox.options.text;
3 L9 [1 l2 C- z) q$ k) e1 ntlength++;
7 N w, W5 P, z( x9 a& p" S* c}
. x# X* i* y6 d$ Lelse {
* k- O h0 Q& n1 earrfbox[flength] = fbox.options.text;
1 t# W3 f6 v' w. Pflength++;/ {( l) g1 T* F/ S% F/ \+ O: n% X2 ^
}
( F7 c5 Z* S/ q3 z- y}$ U* U) s; }/ U( O: ^7 j7 C
arrfbox.sort();
" l& L: w) T$ {: t! {arrtbox.sort();
3 M" f" M& m1 D% G5 u( f, u! D8 T5 x) G/ C- `
fbox.length = 0;, x# ?5 O, x- t& u
tbox.length = 0;1 D* o1 C2 V8 U8 g* Y5 M
var c;* S5 F- I) {) c) l; {
for(c = 0; c < arrfbox.length; c++) {
. s5 Q0 u' F. y0 u7 ^var no = new option();+ R# e1 X! \: ^8 M! @1 i8 S
no.value = arrlookup[arrfbox[c]];1 e: t% f6 | d y* s: w
no.text = arrfbox[c];1 B$ _$ A# d- I' q& j; h' M9 l
fbox[c] = no;; P+ [$ Q; t1 ]' o1 e8 l" U
}
0 L$ j% v) U, }& u- N! mfor(c = 0; c < arrtbox.length; c++) {1 n$ e9 U# O4 Q, P) L+ q
var no = new option();. K5 c, [3 h' I8 ~4 k
no.value = arrlookup[arrtbox[c]];
5 `! y! Y% T8 _2 Z0 B, V, ~no.text = arrtbox[c];$ D5 A& z/ l7 W$ \2 l
tbox[c] = no;2 g& o( C, E/ W& j
}
- e S# N* {( f' s. V}- _ w9 _! c6 l& C- t1 {
</script>2 f- y9 E& e! {6 J8 n
</body>
, @; q, L4 ] t# _% o# t% u |
|