|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14443
- 金币
- 2507
- 威望
- 1647
- 贡献
- 1455
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"( t) Z8 U/ T% p) m% B3 `/ F9 X. M
c pageencoding="gb2312"
. t, K$ a! I6 Z; I% e8 R! K; x%>. Q# ?3 c) K4 s) [
<style>: W" E$ }' J. o2 X8 p
.f9{ font-size:9pt; }
' j7 p1 \. B7 }. j7 N/ ~.bgc{ background-color:#aecaf9; color: #0033ff }- Z* d+ t3 T! G' U9 h3 o" t
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
5 S5 {# g0 ~$ i5 T, { border-bottom: solid 1px #4e7dc1;, [% i2 j( o+ P2 T' A9 ?' F
border-left: solid 1px #aecaf9;" u0 y+ U3 x2 O1 p m/ M
border-right: solid 1px #5679bd;
2 Y: Y; C1 h" N E% X7 R padding:1px;- Y, i+ a1 u& v1 Z9 A
margin:0px;}# {2 |0 j3 v% i9 W( a5 I
</style>; Q2 i6 x! |! v: s. O3 S+ m& a' |( x
<script language="javascript">
: C/ Y/ o) Z& j$ v0 r5 ^0 W4 B* h& a<!--
& ]& {4 L; }8 V+ \& xfunction rv(). o7 ~+ |7 f. E
{
) U% m9 V: ~; e+ \) g) c var val="";1 k' p9 w) h5 n3 ?! \3 E( h0 d9 N
for(i=0;i<combo_box.list2.length;i++){
# k/ v# b5 E \1 D% G6 L5 X6 C val+=","+combo_box.list2.value;7 Q$ r" k( |/ I/ _
}
n) q& {4 h* C: R/ W* @ if(val.charat(0)==","){( p+ w# I6 ~5 A, e
val=val.substr(1,val.length);
0 g2 o, t1 s2 ` c }
1 d% v/ G; R! ]2 \, ~4 ?. { opener.form1.frecname.value=val;; }% o% V5 f- Q5 n* ?' Z
self.close();
- j D9 {$ \$ n! k" W}
/ o; d6 q0 n) K4 \ k+ G5 U/ P+ K//-->0 r* U9 Q% k% m7 H
</script>
+ s) `, D9 l9 L$ m) ?* j$ D: u<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
& A+ Y! W( z8 s9 Z<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />! |+ q* l7 L! O. @; }
<%5 A/ A4 N3 k+ {5 u3 ]/ a
cdatasource ds=new cdatasource(); //数据联结bean实例: F+ M% |) J* ]" f- {- s* V/ i6 S
java.sql.connection conn=ds.getconnection();' r% l- T4 s+ w; S: G
java.sql.statement stmt=null;
( P6 `6 ?6 a/ M8 c- Y1 P java.sql.resultset rs=null;
6 H9 M h+ V9 u cdatacheck dc=new cdatacheck();
8 ?* r8 F8 c+ H$ H, t1 N%>
2 c/ z' x8 T( ]1 J9 u- W" f<%) f% j8 j1 M; F9 D# F L& D6 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";. s1 w' E$ W$ e! ?) t& Z7 S6 f" B/ n
stmt=conn.createstatement();
8 T9 |4 Z, C( O* O1 xrs=stmt.executequery(sqlu);, e6 x% E2 ?2 T* w' r( i
%>( O& j/ v8 J* B% P. |2 [% Q
<script language='javascript'>$ r* I6 p* W/ y! K
arr = new array();% [% y2 V5 ^! G; r% O
<% int temp=0;
9 z" N+ q i9 g. W. Z, Owhile(rs.next())
! r' o* A7 P$ z- L, F{
9 `0 Z* r8 A$ V6 |( f" g%>. C5 ~0 N% L) o$ S) N$ J
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");7 _/ x8 ~8 o/ d: c1 a. m
<%
. B$ r) @1 C& f0 i" n7 Etemp = temp + 1;& x( h. r/ a- y' q8 X# `$ @
}
6 V2 @% A% {6 \/ X# p" T7 C4 [0 b%>
6 U1 Z3 ]) P8 |& X# y4 x% q( Q6 Rtemp=<%=temp%>;8 e7 j, c4 E. H; `
function changelocation(id){
. p, T- ^9 c) y# w2 Q# C3 y9 ydocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
, \5 z( [) ~/ M; g5 N3 ^) Ivar i = 0;
, f2 n% ^& P: g/ fdocument.combo_box.city.options[0]=new option('-------','');
; ^' d& B: L! q3 F$ h lfor(i=0;i<temp;i++){
/ n2 Q) p$ `9 I' I1 Aif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
0 ?6 R' ^# p2 O2 |/ |% Hdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
5 @- U. J0 b" p8 o& M$ G; v0 h4 E* ?} ) b1 E6 u5 ?7 B4 S
} + r( q! T$ `4 T' ]
} 4 F9 M; L; `; {* T ~3 q$ }( c
</script>
2 g1 K' D& Q B r9 u# g; a& Z' _& u& y9 Q- t% X. T
<form name="combo_box">
1 F1 Z- R# t, j* v<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">) Y' P( W% [" h- y, S
<tr height="24">1 G6 j0 d2 `8 p3 s' b# Q
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td> Y" V1 q" t0 Z
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
. L" _, z8 ]; }$ G" _. b' K, t* I <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>' ~9 l7 B2 D* a6 c+ g; P
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>- M+ ~/ Z* V8 {
</tr>
6 A/ I- q ~3 M7 \, Z6 \ <tr> 0 f/ j( N% \: I- }1 \+ I8 D
<td>3 Z& A+ }" M6 G& C7 K2 _2 j
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
: p7 r! [6 `8 j! B8 @! G! r9 N <option value="0">请选择部门 ---></option>
$ b8 u( ~* ?- d1 o<%
8 I& G4 G4 b# s+ b& A/ Z string sqld="select * from tdept";
, [/ Z& J" D, q) _( Qstmt=conn.createstatement();2 G1 M! U; y) `& j# A
rs=stmt.executequery(sqld);# z p/ q: v- o/ I' D6 O1 e% W1 e
while(rs.next())8 a- M- s) g, F- _+ X8 j; P
{! K/ f. F8 ^0 ]' P5 E S
%>* @9 ^; d5 Y3 \: } E
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
& K. b% P) q% H: u<%8 B1 B0 G1 n% u5 {) [
}
7 p# f) _1 g5 l%>
6 X) y5 H" f& }8 `7 x2 }2 _8 B- m, _ </select>
/ {7 V0 K r6 R$ m& m0 P</td>! u* J) K- u9 y" c5 Y9 k
<td>
9 e, k6 W# \7 z' V7 o <select multiple id=city style="width:150;height:200" class="bgc">
; S$ Y/ ^% q7 [4 |0 D# q; L </select>
) V I- k& O3 Y* b9 |& r& B6 g</td># E- C# y4 B _) h k) F. }$ ?
<td nowrap align="center" class="bgc">3 ?( A! ^5 E1 K
<input type="button" value="<<" class="buttons">
/ m Z4 Z( e. B; v4 c/ |+ L. b <input type="button" value=">>" class="buttons">" M2 [) n- j+ B2 n: R
</td>
* c1 S0 m8 H. x2 G4 n. N. H <td>; F$ @* K" x" `0 p/ D& j. X- \
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">9 X0 \* S9 A! _
</select>
$ Y% [& Z `5 q</td>- k6 ?7 D: y9 E4 G+ z' K" u3 C% J" h
</tr>2 F% U) J& A! }3 G, [& m
<tr class="bgc"> 4 V& N1 s, C2 A$ e; y6 c' @1 x
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
6 L4 h4 Y. d3 b9 J& w" p2 g </tr>
# q3 G: l8 r! d, x</table>
4 D% {: A; n/ h$ ~; ^# m</form>
% D8 b1 j5 T4 }/ R# u! F<script language="javascript">% Y% f% l- b0 f) a5 U1 n
//人名移动
1 Z( e2 [% b) _, }$ cfunction move(fbox, tbox) {8 }1 W. e; e. B( ]$ d/ a
var arrfbox = new array();/ A1 g" J. d" o/ x* M; B
var arrtbox = new array();
; _4 b) J* @8 Y% Mvar arrlookup = new array();
+ b. ]2 w3 V0 l5 M- o6 gvar i;0 r/ {/ j' v g% d) G$ e' i3 x
for (i = 0; i < tbox.options.length; i++) {
8 L2 t. G" |8 z2 `. Larrlookup[tbox.options.text] = tbox.options.value;
* i+ n1 Z J2 }% ^) varrtbox = tbox.options.text;
9 j# d8 y& n: k" C: ^2 R}
1 t9 m$ Z+ M, R) { Tvar flength = 0;
2 ^' b- h9 p5 V, _; rvar tlength = arrtbox.length;2 X' q: V* Y3 r+ N
for(i = 0; i < fbox.options.length; i++) {/ \0 z/ ?+ m: x! v4 u
arrlookup[fbox.options.text] = fbox.options.value;
1 x. \) s4 j" d) M" [4 }1 d( ^if (fbox.options.selected && fbox.options.value != "") {
- G- v' N; J; r3 U8 uarrtbox[tlength] = fbox.options.text;# o( Y/ [/ }8 l& n e
tlength++;
; f+ K7 k1 T+ w- X+ S}
! }% C0 K9 u; g, Y7 g- eelse {% L/ A+ x# S6 \
arrfbox[flength] = fbox.options.text;
* h1 u) S4 B+ O, Xflength++;
! b4 C0 T3 X8 s; z6 t }
( N! X) y: A$ ^3 ]# F# z$ X}
+ A! i' U! F$ |7 ^arrfbox.sort();9 f3 n ~$ ?* P! r5 p) ?
arrtbox.sort();
2 r1 J0 I% Q c" Z2 _8 w k( U4 P, h+ r8 u
fbox.length = 0;
# C6 S2 I* F. U: a( x+ [tbox.length = 0;/ ?6 C1 ~" E; I+ m4 }% n) H8 p
var c; i3 b2 A4 F. K0 }0 H, K0 w
for(c = 0; c < arrfbox.length; c++) {
4 b- m& v+ t/ {5 s0 U3 zvar no = new option();0 T/ x9 ]1 Q \/ T
no.value = arrlookup[arrfbox[c]];
: x4 k$ }& N K% g3 gno.text = arrfbox[c];
E0 w+ |& O* ^' L. l4 Mfbox[c] = no;" \9 A( {5 u+ c0 G$ \# m( `
}
) b+ M& i& U( E L" Rfor(c = 0; c < arrtbox.length; c++) {
* r- \' { R! P! \" ~$ _, W& dvar no = new option();
% Z9 E# C% _- k6 a/ {: Eno.value = arrlookup[arrtbox[c]];4 i! B$ C- Q3 t1 E
no.text = arrtbox[c];4 ?$ z* O8 Q* _ a
tbox[c] = no;
. |( Z) @" ]! \8 A }0 \; s" h+ @( I. m/ X+ k; A& V& B
}. }2 i: p: {4 h6 h: Y
</script>
. F2 ~* U! K M: R</body>- g' t9 @; z- K7 w( O) I L. k
|
|