  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14171
- 金币
- 2376
- 威望
- 1647
- 贡献
- 1324
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
$ x* k, ]* Z* K0 V k, o* l c pageencoding="gb2312"
W2 Z* s) j# M% F1 w$ f# v5 ~" l1 p%>; R g$ d4 i/ e
<style>8 j% G$ Q! {6 Z6 k# H6 K
.f9{ font-size:9pt; }
: i8 S7 E/ H- n$ J. k.bgc{ background-color:#aecaf9; color: #0033ff }
G- ^: f6 X! L.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
# b( ~0 G8 _$ ] border-bottom: solid 1px #4e7dc1;
R5 I( e2 W2 n+ A. J# W+ Q& D border-left: solid 1px #aecaf9;( U3 p* }- q J* n0 H) K
border-right: solid 1px #5679bd;! u7 H8 Y) K( F% F7 V
padding:1px;+ r' x; E5 t6 n# [+ J
margin:0px;}
1 W$ G. O' R( o T' E7 I9 r</style>9 {3 ^) F: z$ b5 ^
<script language="javascript">
* j; ?$ i5 R5 c0 r) ], o<!--; y$ Z- o' _! {: ?7 O6 D
function rv()' S! R1 K: g& I" @. ]9 D
{9 P( m" B. j9 L' j1 J/ x
var val=""; \& z; u) t- R- j0 E$ l
for(i=0;i<combo_box.list2.length;i++){
) [! @ i( g6 H8 _% e val+=","+combo_box.list2.value;1 W' {4 a2 L. T! B- ]* W8 g
}
" M- z- u; Z5 `. \7 Y' v if(val.charat(0)==","){/ m0 U9 X. S+ N9 h
val=val.substr(1,val.length);$ L7 [1 V2 k8 c6 ^1 I# i# w
}% K: t0 X' _& d! l4 g
opener.form1.frecname.value=val;
$ x/ f7 o2 d; O$ G7 m self.close();% o6 w+ [$ f: z& n( h" i
}
: I5 H2 c. T* h//-->% Y" _) W0 M2 L0 |
</script>% f) C/ ]5 D n8 Q8 V6 O
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">! J; O/ A" {" p7 L0 d
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />4 J6 ?$ \+ s5 v/ y* W0 Y) L2 @
<%
3 V2 m/ ?: u8 I# z5 r3 H0 P% M cdatasource ds=new cdatasource(); //数据联结bean实例. |1 O0 j/ ^- C5 F# [; `- C
java.sql.connection conn=ds.getconnection();
& ], m! ]8 s. L2 m! O0 a; a java.sql.statement stmt=null;/ i; y& J3 x8 I ], n# y9 |" |9 ^
java.sql.resultset rs=null;
) }( b- p5 o6 B" ~2 e, p# Z5 A cdatacheck dc=new cdatacheck();
9 z. X' |& q# A+ H) g# {%>; |) \6 D) f* I4 B( y+ Q# w
<%( x) A8 n2 K; u" L @
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";+ b6 S7 `& y H
stmt=conn.createstatement();4 z4 ^4 m; b: |! [- H# l2 f
rs=stmt.executequery(sqlu);
& `$ F9 e i* [. {6 y%>3 f- u0 r/ T6 E q! T
<script language='javascript'>
7 Z0 d2 d k. y) A* narr = new array();
! q+ c5 C$ G+ }$ B7 F. M+ @) |! k<% int temp=0;
5 f* l) u& E& qwhile(rs.next())2 O) _( g* Z3 X* m' Z$ e
{& Z" |8 Y0 g2 b% J
%>0 N1 _6 z" t, Y0 x5 l
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");! ^! O; R; b$ N4 D
<%2 d, m5 P+ c( I! [9 M0 w; ]
temp = temp + 1;. t8 B0 A( e% H1 ^2 K$ F2 [9 o; ?0 m
}/ R4 V9 @! A* ]/ H- D
%>
7 M$ V0 U4 @/ l, D1 p& j& otemp=<%=temp%>;) R7 f6 r5 n7 D5 z( K
function changelocation(id){
k% Y1 p) F: `6 X3 \8 Bdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
8 }) }) g: _/ s$ Xvar i = 0;
4 \- C$ U/ `. \+ cdocument.combo_box.city.options[0]=new option('-------',''); 9 J) U) u! F" K
for(i=0;i<temp;i++){
1 h! x" N9 z5 [# f" @/ Nif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] 3 {7 i U: B8 z% @
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); # `0 O5 i+ _1 _; R
}
$ X: L5 Z( H5 \' f% G2 v} # n- d, D% N& E5 o+ x+ a
} 7 Z& d5 Q5 [) `! a* E& ?" F1 m
</script>& ]0 j! h" e$ }0 b- V: _
5 l& m* z: _+ W: n. ?+ r' }<form name="combo_box">
8 a* z. C- V' R<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">, i& H" q; v2 ]
<tr height="24">
3 r+ e) k. W2 a0 ~6 z3 K <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
9 d" D0 t$ }$ P! T. f5 r& f; w8 l <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>4 z" q0 h6 B: J ^/ D1 C- ]
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
7 ]4 f; p4 E7 f1 ~: f5 t. Z" v5 l <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
' z. V+ J4 V( a" @9 E </tr>, D: j2 u% `, _+ L% Y9 X0 u( R
<tr>
" J; ~4 ]8 Q5 a% t2 W/ { <td>5 t5 s/ x/ Q9 w4 D z# r7 s
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
" d0 x @0 _0 {# X' ^! g <option value="0">请选择部门 ---></option># v$ _% `' u/ w1 e' F
<%
" ^5 s4 C: @( k- ~ string sqld="select * from tdept";% o' S; Q3 S" \. C: H6 n
stmt=conn.createstatement();
; R! c4 j& `: U6 a, g' ~2 f7 M: x9 Brs=stmt.executequery(sqld);
, s2 n: u1 o5 O% E' |7 @while(rs.next())* X q5 `# x& K$ j* }7 W
{
" v' y* v7 @' C/ C$ f0 a%>. P9 ~# J. H4 v
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
* f3 p- u* E1 W# X<%+ N) K& Y9 a" z8 C7 u) S
}
& k1 e2 ~' W3 L6 I; I4 d%>
% q' x! e5 C* j: H9 o </select>
' M: K# ~# }9 h4 ]1 c</td>
; n- j" `9 Y3 }5 @ <td>
+ S; U- c# O0 a* @2 y! O7 ?7 \. y* ] <select multiple id=city style="width:150;height:200" class="bgc">
5 S/ z& r4 G* J </select>
( O% b8 \ R: S0 s</td>
- o% w/ L4 j, V. t9 X+ } <td nowrap align="center" class="bgc">
8 t& D0 `) O: S9 H* G! b& P <input type="button" value="<<" class="buttons">& s; M/ H1 Y% A1 z0 a' g
<input type="button" value=">>" class="buttons">
- [5 S- i- O# z9 v: r' ]7 Y9 F</td>9 n1 t2 q, M% }2 a9 _
<td>
- L0 g( l6 J0 A <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
7 \( g+ T8 a" `9 a9 k* x6 `* O7 | </select>
: a7 f3 b: _( e( _( R</td>
+ D& b- J- f* [( n </tr>
3 m7 `2 N) a0 Y( C" T; \ <tr class="bgc"> $ f; X7 j6 }1 `: r. Q
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
$ z, U: ~# {6 W" G6 z+ s5 M </tr>
; z, K! N! S) ~/ k0 A+ a1 J</table>
# Q" ]5 l- n- B: ?9 D</form>6 s5 u: E1 }0 M5 t1 d
<script language="javascript">
* x& K+ M& F( @$ Z: T4 C/ a//人名移动5 S* j: [9 P+ W# T$ _7 H
function move(fbox, tbox) {$ ^+ l2 u7 Q* G
var arrfbox = new array();5 u P' D" w3 q
var arrtbox = new array();
3 C# \, ~, I# K7 A# N$ }var arrlookup = new array();/ d) J* Y" d5 D |
var i;& b: j8 Y3 f, ^) ^
for (i = 0; i < tbox.options.length; i++) {7 d8 t2 ]" o" F4 E
arrlookup[tbox.options.text] = tbox.options.value;5 n& [ Z6 `2 V" \
arrtbox = tbox.options.text;
5 g7 T9 n6 C4 ]- d6 b: U% t" l6 N) h}! P0 A/ S1 C$ Z9 k; G$ J# t
var flength = 0;; T4 d+ K4 \) a# @
var tlength = arrtbox.length;2 Z1 v4 z) Q2 o3 E
for(i = 0; i < fbox.options.length; i++) {
) d5 \/ C/ C6 q4 b# x% warrlookup[fbox.options.text] = fbox.options.value;
% z9 ^- N3 z2 \8 D+ e3 G7 _if (fbox.options.selected && fbox.options.value != "") {
% u$ o0 y% ?3 r2 ]+ H6 uarrtbox[tlength] = fbox.options.text;% I0 D5 U( m" ~5 c
tlength++;
) P$ y2 L" r, d5 ]}! }" z3 x9 S3 a, ^% B& P
else {. a. x$ Q8 O2 k$ v- r( o
arrfbox[flength] = fbox.options.text;
2 Z& c* g! g3 i0 ]+ k4 G% y6 s! e H. D+ \flength++;
+ I7 w& T7 C9 a$ R \& [! G" U }5 W. l0 P- Z3 F
} G( D8 ]/ q8 F |6 x) P o8 J
arrfbox.sort();
$ e) }" A. ~: T1 {3 V1 r, t* I8 Varrtbox.sort();
$ q6 h0 A* P9 j7 H+ o9 g( [/ Z7 s& l1 `- f: _0 b! d) w6 B
fbox.length = 0;
5 B5 _" Z! y% I6 p( y; c$ `tbox.length = 0;
& U9 @5 J) B- X# I$ t' w: Evar c;
$ `* z1 v2 n+ n. u4 T/ ?! ]for(c = 0; c < arrfbox.length; c++) {( ` f8 ?) ~+ l w
var no = new option();
8 U+ l" J0 `' hno.value = arrlookup[arrfbox[c]];9 y1 S# r$ S1 V; k( b
no.text = arrfbox[c];
4 \& |& h/ V8 x& l# }fbox[c] = no;
8 x6 R! o2 B2 n1 L. W% z) W$ Z}) z( t3 Q4 `( @0 u
for(c = 0; c < arrtbox.length; c++) {9 a2 R# z) |4 H( q8 X
var no = new option();
; @! j8 _. G" R3 ?# O' {$ Y6 k3 }no.value = arrlookup[arrtbox[c]];1 P/ H$ `% Z3 g$ L
no.text = arrtbox[c];
: ~% K/ a T( ~" l: q6 ]tbox[c] = no;
. Q& r% t. e( o7 n B; F) X }
6 B7 g; ^& `% \) E}+ e. N3 u! G1 P4 h% u
</script>
) H# D/ k/ W# K2 r8 L</body>
* f) ]1 L: f, f, U1 B |
|