  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14163
- 金币
- 2372
- 威望
- 1647
- 贡献
- 1320
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
! w$ {: q- t5 |8 s( r c pageencoding="gb2312"! ~ `5 S1 m+ \( B0 z0 x
%>1 c: C3 l6 e+ {
<style>
8 `. L2 ~" S( k/ K+ K! [.f9{ font-size:9pt; }
& X* n( o/ R2 I; x9 O.bgc{ background-color:#aecaf9; color: #0033ff }
' o" _ u+ |5 F$ ?.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;5 {; W2 G K1 j. ~& t
border-bottom: solid 1px #4e7dc1;6 B; U0 @- c0 S# \' c
border-left: solid 1px #aecaf9;
0 o y0 G; s* W$ m, J& B% o border-right: solid 1px #5679bd;
* I H+ p: t! B7 B padding:1px;- B: I; f6 o1 h2 d1 ^% ^, }
margin:0px;}
9 C; l6 A, o) P* k. t4 E! V</style>
1 u* N; ?5 U' O- e% e<script language="javascript">- I6 Q5 f/ B& ]" W- u1 m
<!--
$ A* v: M, a Zfunction rv() i [* Y) M; y& A; H+ x
{
, [- ]- r6 V# Y) N' V1 ` var val="";. _- v: G/ a5 M8 [+ R; {: V/ P
for(i=0;i<combo_box.list2.length;i++){/ h; X5 w$ `. w# m8 B3 q
val+=","+combo_box.list2.value;5 Y3 f( ~4 B% Q1 v6 p7 v. k3 H
}
( e# A8 o6 P% T) _ if(val.charat(0)==","){
+ x$ l4 k9 L/ \2 ]7 t& _. ~$ u val=val.substr(1,val.length);
( w5 P# L5 }1 p* a- s/ a }* v/ ]0 Q8 `* C
opener.form1.frecname.value=val;; k( x+ z2 }1 h
self.close();9 c# L- O: y9 m% `& y: c4 x9 m
}2 H: M$ T; Q& ^" R. W" |8 U" C- O
//-->, C( K+ ^ V- V! w4 \
</script>
' ~" ~' F/ t- F8 i" z6 G<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">" K% Q& P* V. G- H: t* v
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
3 w. [( V' c. {/ G& J3 c' Q<%
8 j0 q* t" ~ H* [! [; |/ f8 v cdatasource ds=new cdatasource(); //数据联结bean实例
7 V" N: {* l- }/ M: I java.sql.connection conn=ds.getconnection();
4 e2 v8 B- n0 j# A java.sql.statement stmt=null;
) R3 B5 {; b4 y6 C5 D2 I$ F java.sql.resultset rs=null;
; {8 V$ H1 r, ]/ O$ h9 P. W cdatacheck dc=new cdatacheck();
/ m. Z6 u+ d* ~$ ~1 U' E7 b%>- k" F' ^9 X" k" l C
<%2 `+ g2 N; V9 j( e3 b7 h; j8 R2 \
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";$ e" i+ F5 ?* r
stmt=conn.createstatement();
! N; D6 ]# L4 b6 drs=stmt.executequery(sqlu);) s8 Z( l( n% _/ a) l
%>9 F6 R6 c: Q! ~/ ~3 U
<script language='javascript'>% i+ r, K9 {) C& `4 B1 l
arr = new array();
; L" M% D) `. h1 m, _: S( Q. }<% int temp=0;
* |% _5 t* K" s' `. vwhile(rs.next())
V$ P/ ^( Z Q3 s: B- ^, u: M{- g. a# d. ~' x4 {/ }" k
%>; }6 t! b' }* U, X- Z9 X2 e& g
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
j* ]" s3 Y. M' ~<%" s2 x# f4 B! U3 s3 Q5 O
temp = temp + 1;4 k1 y, `" z) l: ]5 f0 j9 e2 r* r
}' ~) s( H4 x$ G& ?6 ~4 C
%>
. x" [/ A& H3 etemp=<%=temp%>;
8 K1 p6 B4 D* b k, ]function changelocation(id){ ( @* n, g# e$ o/ X) r! b/ k
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
! c5 L; O# T0 S5 {var i = 0; , C) `9 V m3 L4 L: d7 C1 v
document.combo_box.city.options[0]=new option('-------','');
+ }) A% I6 {* Hfor(i=0;i<temp;i++){
6 d, R* \- v# zif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
9 b: X: E d9 M, u. e# ? M2 adocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); . y; t) x4 c8 A W; t5 l& e% k
} . ]0 D4 q& q# `% i$ P# \
}
$ W8 M8 ^( M" w& g& m8 t. R& l} * r: |5 t2 } y" A$ k4 f' Q" W: ]
</script>3 U ^; o& U6 v; i' e" `
4 `+ O/ [+ B8 `+ W8 Z<form name="combo_box">1 Q, y8 C$ g5 q* d4 a W# ^
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">" i! I: [0 l" P3 y2 u0 A
<tr height="24">+ {% C5 d* j9 z" M: T- h3 M6 @
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>( |2 ~ Y$ D3 f; x7 |* |
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>2 {' c1 c8 C2 @$ y# T
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>* }8 z# I9 U' L) K( {, G Y+ ^; U3 T
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>& J4 L; p9 G) X6 n8 }6 z
</tr>: w* L# g$ j" t% d/ a4 R4 m
<tr> ; G6 r( k# Q' V O6 t% n
<td>5 V- Q7 O2 Z( d8 d
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">( H9 a2 r4 A6 R% s6 O7 Y
<option value="0">请选择部门 ---></option>
0 v6 M$ C* R; a1 d5 b<%
3 ^4 H( I t2 A6 A0 ] string sqld="select * from tdept";% O8 {, U- V6 N! A/ V9 G& g
stmt=conn.createstatement();4 O1 ^! T9 [3 \6 ^
rs=stmt.executequery(sqld);2 [- R3 r* [2 m: G
while(rs.next())& \8 t/ s( n- z, z
{
# Y8 s! B1 ]" q, m%>7 N, U ~' m" s2 K5 {; h
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
. K/ n$ O( i; o6 D7 g5 i<%
. h/ Q/ d/ h) f- b! x. m: C}" O/ }3 h3 M7 T2 _* d, B- u/ _
%>
! |4 t- k. h8 K0 B/ Y' P* t </select>
! W2 {3 p) O! e) @$ G+ E</td>
9 ?& F' y9 R5 A; N" l: w7 M' h, u <td>3 L/ [6 y; ?1 r3 \
<select multiple id=city style="width:150;height:200" class="bgc">. t: |3 H, Z. W; H
</select>
1 G' U; O' n3 }4 l5 G# H; E% u4 E</td>
5 z6 T- g( u8 |5 ^% E( D <td nowrap align="center" class="bgc">
% R/ i7 e( r# e+ }0 o <input type="button" value="<<" class="buttons">
& |, s5 x+ M, r <input type="button" value=">>" class="buttons">" h7 e2 ^- }" d c, R5 y
</td># B; R b3 C& A* R' @
<td>
, o0 o/ B7 Y9 e" T, K1 H/ y: H <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
) J ]; ^! J% b </select>
' p. V/ B A& m; V. k* |6 T</td>, |% y( r( e8 d+ M. Z
</tr>$ v& s5 G# D. h5 U
<tr class="bgc">
+ s, t: J; a9 e/ v$ a <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
) ~ B7 {7 p( b& B) v) u$ G, ^ </tr>" Q: u3 W: K. `
</table>/ Z5 ~* Y( [% j& {* V
</form>+ ?& ]5 r& v7 O, b4 F, n# V7 C: N! F
<script language="javascript">8 \' z+ g1 O. G+ X
//人名移动
+ r* Q7 O4 g. k. G0 F6 C* \function move(fbox, tbox) {; L0 w% N& B! u$ d
var arrfbox = new array();* O. F) ?2 ^' W) r
var arrtbox = new array();1 C2 d$ r& h, `/ n0 M
var arrlookup = new array();: E! ~* S7 d9 I5 F
var i;7 I5 V6 z' z. N
for (i = 0; i < tbox.options.length; i++) {
6 l5 b4 x/ C, _4 l9 n- ]arrlookup[tbox.options.text] = tbox.options.value;
) l' D9 c7 T' a a9 Y' Rarrtbox = tbox.options.text;
8 S) i3 B6 n7 l9 M: Z: M7 n}% t" X3 f6 D7 k; g. r2 ^0 B& v2 u- W
var flength = 0;& G: c- f7 m2 {0 ]
var tlength = arrtbox.length;
( ^( T. U, b& ]for(i = 0; i < fbox.options.length; i++) {
* d+ Q: k: O1 `3 c4 K& h9 Zarrlookup[fbox.options.text] = fbox.options.value;( P* I$ U t8 A, [& |) h
if (fbox.options.selected && fbox.options.value != "") {) v+ }/ R. S" W! d) B$ ?
arrtbox[tlength] = fbox.options.text;
* J# @) ], |8 o. h2 Atlength++;
5 X# i8 n3 ] V$ B Q}+ r3 T5 ^& t4 V- u) y) N
else {3 S6 C: d. |' E$ \6 {0 ~( | F+ c
arrfbox[flength] = fbox.options.text;# v6 p% j3 r) V; p( w
flength++;+ X) ^" |1 D/ T
}
1 Y& g: U9 W& `( S4 \7 ]; c. \: n/ T}
1 W! q6 ~* G; J; carrfbox.sort();
; P7 \. [) n, ~2 c% r/ |) }; Oarrtbox.sort();3 D+ k3 f' q8 v9 X0 p" g
$ [. Q6 e& d6 L: w8 F4 V
fbox.length = 0;
% e5 f5 Q6 r. Y5 {0 i# Htbox.length = 0;* M6 O+ s# f5 v# |
var c;( W8 n: V0 q* k- _" R
for(c = 0; c < arrfbox.length; c++) {
% o7 x; O b3 m1 dvar no = new option();* L8 m7 H% }1 P
no.value = arrlookup[arrfbox[c]];; R* X, L' [' Q& D* v% l: H6 w& f6 P! D
no.text = arrfbox[c];7 S6 A$ m% _( n C* h. ?3 [
fbox[c] = no;- o5 ?! _+ `3 |$ M1 q
}
, F& I3 P3 F" Bfor(c = 0; c < arrtbox.length; c++) {
8 S% u. w% s/ q2 ]var no = new option();8 S7 m8 o* L/ C' D0 K; i
no.value = arrlookup[arrtbox[c]];
$ a4 I( T7 f/ y5 k: W' t. fno.text = arrtbox[c];
6 | K- \; F4 y" o+ }3 j+ ]tbox[c] = no;
0 Z t8 Z, j5 A6 y! e# l* b0 W }4 J2 d' |5 c1 J/ W$ P3 c
}0 ]! h# i+ x V! O% h' [
</script>( K% t, H; z |8 {9 k$ p
</body>3 V! d! H: B% y! S$ D8 j
|
|