|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14387
- 金币
- 2479
- 威望
- 1647
- 贡献
- 1427
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"/ Y. O+ H1 Y; S+ w
c pageencoding="gb2312"
) s7 o& ^6 C" N! z$ F3 y%>. `* e) e0 U$ y8 U
<style>
! L" y2 q: g! }.f9{ font-size:9pt; }3 Q2 Q6 W* _$ F4 T( d9 t
.bgc{ background-color:#aecaf9; color: #0033ff }
1 `+ l% U* t) M$ G* e.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
0 W! y3 k& }" ^# `# @ border-bottom: solid 1px #4e7dc1;
3 y5 W& X6 d' K; A* j border-left: solid 1px #aecaf9;
, P+ e; ~( h$ V border-right: solid 1px #5679bd;
2 g) c; y1 H$ t; A# p4 I% v padding:1px;" J( V/ [% q- N8 D9 e' I R F
margin:0px;}. M( c- b0 Q- C" C
</style>
! y1 T( Q2 x L L4 X$ M<script language="javascript">
' H) H2 V, a; `, K<!--
4 t) ?7 G" `$ |% P( ?function rv()9 E' i, w$ J. B+ K8 p8 g! j; z& M
{
3 ^: E5 R8 u5 I6 ` var val="";( h% Z8 w. |; O4 ?) x4 Y% R& l# a
for(i=0;i<combo_box.list2.length;i++){# ~, W: C/ B; ]# [+ W# D% u5 a9 _# A
val+=","+combo_box.list2.value;9 n" d T3 H0 T
}) f4 s3 A1 Z" k# [
if(val.charat(0)==","){
1 E9 Z9 H% r3 f5 Y* O val=val.substr(1,val.length);% ^ j3 Q- O( i3 F t" ]- c
}- d# C, ]9 d" V* Y" A4 ^, u
opener.form1.frecname.value=val;
! t2 R5 L0 f3 D; | self.close();
2 O# T r" f; o: s$ N, v}
: }8 Y* N$ J% r; v//-->& h$ J4 j, h {# h
</script>
/ _/ L9 G' K3 e1 ]. B' `3 V<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
3 S/ Z8 t6 O" _4 C8 O. U' w9 a<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
. U! ]" T1 r8 C* x" e& B6 h' w( D<%
8 n: A* f0 G9 N cdatasource ds=new cdatasource(); //数据联结bean实例( \' x5 r0 @; t
java.sql.connection conn=ds.getconnection();
% R$ I4 j9 k+ v$ U( X java.sql.statement stmt=null;
* i- Y7 k2 Y1 Q0 C java.sql.resultset rs=null;
. l" v* c+ n" o ] cdatacheck dc=new cdatacheck();2 l% M, `8 H3 A$ C4 }
%>
. e0 W9 c U9 f( p8 @<%, n( ~5 E, O6 M* \' r
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";
4 @4 s, {+ s1 j5 i- d% fstmt=conn.createstatement();
; v* E' f1 l2 Ors=stmt.executequery(sqlu);+ i0 C, V9 ^2 R9 [* m: R' |8 l1 t
%>
5 ?/ G' D* u. Y; k<script language='javascript'>; _ s3 T% k# h2 w' ~4 n
arr = new array();
. z5 |: F- v7 u( [/ O. ^<% int temp=0;8 I. A" ]8 Z: L
while(rs.next())
7 K% s. |! A0 M. E0 g" l, R9 ~/ A{! p& f R9 z! f: U3 D
%>
2 T& \; N, T- } z' |5 T* W& T0 |- Marr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");& D$ ~7 z8 V* Z! h H
<%
3 V; U0 V8 s, f' j6 |" _! ntemp = temp + 1;. M5 w6 a3 Z) d) }
}
' G* U* U( w! L* [9 J. E8 U' C%>5 F! Q, A% X! j% F+ G# `* `
temp=<%=temp%>;
( G2 Z4 B7 l' _' Z: w1 R" cfunction changelocation(id){
7 \, K. ]1 T' {3 A- i' idocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 1 I+ c2 @# `. y$ d7 L: O0 Z
var i = 0; 5 Y2 J: E- F! Y0 m
document.combo_box.city.options[0]=new option('-------','');
0 C! R: Q3 I4 P0 M& a* f& N7 O& O Tfor(i=0;i<temp;i++){
" z/ T+ g Y) {- k, eif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] ) [2 f/ b# R2 w% W T
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); ( j6 R9 P1 U; A* [# z: M8 Z* o
} ' r; q6 V( x) P6 r4 F+ t: I
} / S9 l5 ?6 u) W8 ]( U$ E
}
8 a9 Q1 O' ?5 p, K% N8 f6 y</script>
5 I: w3 w/ I7 ~7 e! T- w- s1 w1 m7 E1 C+ N( C' [; c) G
<form name="combo_box">/ {3 w0 }( }$ v8 r% F& p
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
: h; [# I6 S4 t9 [8 \ <tr height="24">
1 e4 _) H- S- E: j' U- A8 @ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>6 B0 S/ t* V4 c4 u3 x
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>/ a/ q# L2 B) n2 h- C
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td># m, L+ L, f( s
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td># v. R- Y, |/ l
</tr> Y8 L6 k( F. S+ D8 U7 z& b
<tr> / J! [& b& R% v# h7 [& d% H
<td>/ I7 [& ?* E9 q! w& i: L8 T
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">5 |3 o: e& b3 n( a
<option value="0">请选择部门 ---></option>
0 \ X$ a5 G5 Y- W1 r; C5 q<%
; d5 z8 s8 |& O+ C, b2 Q string sqld="select * from tdept";
: v# v: y1 N0 g6 M0 lstmt=conn.createstatement();; [( v+ W* s2 z3 H/ M b
rs=stmt.executequery(sqld);! r3 d. v+ [0 V# g: `; F' c/ ~
while(rs.next())- j7 \# n& t* i
{
0 L# ?1 q1 @ R' ]& J- T%>
o N7 U" N% m; V2 l6 U <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>: Y ~# w5 f, [8 s
<%! @2 W2 v" x: P' g4 M
}
6 @$ z9 l1 F$ n%>
; ~+ ]$ k3 |& T) f% t$ l </select>1 E% }6 J( o9 }+ I; S
</td>
, p& ~ u2 @* M. z/ c1 J) K <td>! m1 C: b4 \" N# \: {9 U1 F5 h/ T3 i
<select multiple id=city style="width:150;height:200" class="bgc">& p5 k% f- W) n
</select>( k% ^0 Y4 P1 ? m" ^- A f( e
</td>3 S/ g: h+ o5 S2 B/ }' n7 b
<td nowrap align="center" class="bgc">
) m# D3 ?( S* h' f8 e <input type="button" value="<<" class="buttons">1 }# h( K" x) Z$ T! }
<input type="button" value=">>" class="buttons">, d5 R1 }" m' B) R( A
</td>
- o/ @. }; R D7 F4 y <td>+ d6 I `, {# |+ ~
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">* H0 l6 [, Y8 \+ T3 c* J! k- A
</select>; K- X | E" J8 }# U
</td>
6 }4 s& n3 B& Z6 E9 g) C </tr>
1 y0 @( \4 @# {1 Q& Q4 m% P <tr class="bgc">
- C4 e- I) ?+ |, ]* C <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
, L; [9 ^8 o, t, w </tr>
, n: X7 Z/ f8 G% Y</table>
- }) |( k( Y. y</form>& k+ R0 m8 _ U$ @
<script language="javascript">. r1 c3 Z; T; \: @1 \- A: }6 Z# a8 |
//人名移动& i! N0 a& @/ h" X
function move(fbox, tbox) {: i* b$ H7 o# _* S2 n
var arrfbox = new array();
% N% c5 X) U. Gvar arrtbox = new array();
- \1 q' Z t1 t! vvar arrlookup = new array();# A2 H2 T2 B) G; t+ y( ^6 W6 h
var i;" z8 i- m2 O. @0 f1 \% t
for (i = 0; i < tbox.options.length; i++) {$ M3 M% _& n8 ]
arrlookup[tbox.options.text] = tbox.options.value;) B! I8 X8 ~, p/ M1 k9 V: o
arrtbox = tbox.options.text; j& t! E& h. ^* k. L% r
}
. l( ^) _" p+ N4 Nvar flength = 0;. f1 F U+ ?' a7 ]5 n- B
var tlength = arrtbox.length;
$ d9 g: A6 x @3 ]; V7 J- Wfor(i = 0; i < fbox.options.length; i++) {
6 `9 c6 [3 P) h* X1 P# k0 f) ^arrlookup[fbox.options.text] = fbox.options.value;/ e2 S3 i3 R- y8 }& a$ a9 s8 \
if (fbox.options.selected && fbox.options.value != "") {: \4 Y8 d5 n+ H8 E. W/ f `9 X* z
arrtbox[tlength] = fbox.options.text;. z: ] C1 T- t; J9 v
tlength++;
1 l/ T# N* x& v) s}
* C* Q/ V; [. x9 F+ Ielse {
+ k/ r+ e3 I3 }2 l# X _& `8 iarrfbox[flength] = fbox.options.text;
' q& k9 \9 R1 V8 j; Z- Z0 sflength++;4 J6 r, J! z/ v
}
% E/ B; H# l: \1 h+ `3 Z6 V}) S* i5 D( Y! F
arrfbox.sort();! [3 _! p; ?* d
arrtbox.sort();
2 f- `! R! y4 g6 ^* U/ L/ Z- f6 o5 N5 `* e$ U) T" ?& {! ?, f
fbox.length = 0;1 }; |6 S4 C# a& }7 {
tbox.length = 0;
$ D$ Q2 E3 v: W3 N7 ~9 k8 ~$ c6 \* r1 [var c;
1 W$ c/ h/ d. }7 x" b1 Rfor(c = 0; c < arrfbox.length; c++) {" ]0 [$ t# ?; x/ i
var no = new option();
3 w b' T6 h: D# Uno.value = arrlookup[arrfbox[c]];
- |; A7 M6 E" ]no.text = arrfbox[c];1 f& o2 I4 n5 Q! |# R8 z
fbox[c] = no;
, e, G( x. N4 p% j1 m}
4 R# R: D2 F: N- L1 F$ T; @' ?for(c = 0; c < arrtbox.length; c++) { w1 V$ g, n: a: o/ j e1 m5 j
var no = new option();2 Q- `) P8 n8 K: D* R+ Q
no.value = arrlookup[arrtbox[c]];0 G$ T" ~4 m& \ i* S
no.text = arrtbox[c];
; |/ l) [+ n$ @; I- S* o" stbox[c] = no;8 b( u! h1 k, ]# V& h% T
}
6 M1 u7 \* \5 ?+ z. e# f2 V' e}: ]* T$ g5 Z/ g
</script>% u) I6 t5 _& S1 F+ ^: q
</body>
9 I3 o7 `8 Z* T6 o3 g; Q; }1 I& s |
|