  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14221
- 金币
- 2401
- 威望
- 1647
- 贡献
- 1349
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
, j) ^# N/ K/ E! p5 e9 `7 i c pageencoding="gb2312"% t) x! y5 U i# l
%>" C/ u. Z: F6 C. r2 T
<style>
% r* O4 E* [, m6 }2 r2 c, H5 h.f9{ font-size:9pt; }
; ]! N4 N, ]. J& C& l0 f9 P.bgc{ background-color:#aecaf9; color: #0033ff }! \9 } O! n2 Q0 `' e, y# ^
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
! o6 I' {5 X) |/ [! Q* s border-bottom: solid 1px #4e7dc1;
: l7 {' |2 P4 Y) P* y border-left: solid 1px #aecaf9;' h+ b9 C$ A7 X! p; H5 o: J
border-right: solid 1px #5679bd;
" n1 T2 g2 @9 n+ v' u padding:1px;
/ T7 o: N* U6 b: r margin:0px;}
! X, L1 ~4 V/ q& E+ I, k! r</style>7 F% I4 f/ k1 n# s2 b( D
<script language="javascript">
% {5 c$ r6 a- [ ]* ^<!--
3 N2 s2 b3 s( R* ]* F- L7 |2 E% Yfunction rv()
! N7 t& K/ M4 o& `" ^9 J- h2 {{$ @9 j# j5 [% p
var val="";3 k5 x, ?9 J& l1 J
for(i=0;i<combo_box.list2.length;i++){
/ J7 A# @) @4 r' f& j$ @ val+=","+combo_box.list2.value;
) N0 Q% \2 T& y0 r0 G" Y: x+ s. J }
4 J# U, y8 ]9 H" n if(val.charat(0)==","){
f; k" o0 [; I7 I) [ val=val.substr(1,val.length);
+ L4 n% i V2 M$ f! w }
% h! F1 W+ `3 }5 ?+ P! y opener.form1.frecname.value=val;
7 t; s; ^& Y6 L4 s* O2 { self.close();$ b2 U) v; h" v6 U
}! V3 e5 [! l T7 L% s
//-->
* L9 p$ S& ^4 P9 b! e a</script>
" C# _$ V! F; {2 ~7 O- C2 g<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
$ w: U/ U: v# L! V3 T) m/ w& _3 d<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />% J. b% E+ _* d# n9 [1 U
<%
' \, p) G" ]$ g. e4 e/ B cdatasource ds=new cdatasource(); //数据联结bean实例
& b# W) ^" |0 w( a0 J java.sql.connection conn=ds.getconnection();
: C6 \4 X- M& ^) c9 n' } java.sql.statement stmt=null;% u. \! D* O# f6 p& x
java.sql.resultset rs=null;
) @2 z) P( ]& R& X- b3 z' X3 ] cdatacheck dc=new cdatacheck();+ r$ l, ~' r8 N2 L
%>
+ _- |. ~% s) o: m# l5 C0 ~6 J' `& K<%
/ O( k1 k* g3 H u# @: wstring 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";1 M7 g" D5 X# n* f6 m; c
stmt=conn.createstatement();
7 F$ ?" G. H# @6 Z% m: w$ wrs=stmt.executequery(sqlu);
" e1 y9 G# g! }$ m& S$ }; h. r8 }( w%>" U" d" `: v) p- v; n) U; d
<script language='javascript'>7 n; f9 k0 \6 i$ \0 K
arr = new array();
. R4 o2 l3 a) ]3 ^3 d! G<% int temp=0;6 i* U" Y6 O/ h- Z
while(rs.next())3 y% }& [4 S `' m: C
{
' U9 @" p/ l3 h%>
$ U) c" n1 q1 N7 S" Yarr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");# z" _+ N( \5 }, B/ ?
<%1 n2 S9 m( }/ h6 u: g" ^0 i* K6 n
temp = temp + 1;
" b$ N* n& V# |' Y/ r' e1 S}# Z k9 l: T% T9 K' I1 o
%>6 D @% w' M, [+ A3 q2 k
temp=<%=temp%>;
( [! E5 R& a% V5 Ifunction changelocation(id){
+ G' y+ b- ~! o" U' V. |1 c$ Ndocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
: g( D O$ r% }* g: avar i = 0; * M9 r. X! f! s5 p0 m
document.combo_box.city.options[0]=new option('-------','');
4 m6 h( i3 I* O) X# Nfor(i=0;i<temp;i++){
r/ o" b" T. X# Aif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] 4 P/ l9 G4 k/ `3 ?8 i% v$ p
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
7 E# Q% }, W3 B% O3 ?4 Y& G}
, X# U0 X& Z: n; y/ H4 F% _}
( o& B; `/ L* ?% }) j6 s} ; `( l x. k+ n. `5 S
</script>; X7 q( j, v5 S1 L1 J
- ~5 g2 b+ S8 M' i0 F# p
<form name="combo_box"># h. r4 _2 j ?) c# z$ i/ t4 Z
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
C& p& U' D8 E( k <tr height="24">
2 Z3 K; O+ D9 @ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>5 J* o8 F8 S1 ^8 \2 A4 _
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
. c c$ n; k [# l+ f <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
6 f |9 A! u1 H4 [ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
$ F) x) s$ d0 \ </tr>; k- X; Q- R% S$ \$ {2 ^/ L
<tr> $ Q' U1 E6 X( `# \+ N8 b
<td>* X7 l: T; f3 K9 `1 \6 P. d
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
; G2 |. I% g4 D8 u. e: P/ H h" @ <option value="0">请选择部门 ---></option>5 D* ^4 U, L( D6 P! I* H2 [" T' b4 m
<%
0 R; m0 ?; ~5 W+ `0 J* E8 c4 m1 I string sqld="select * from tdept";
+ p1 b" }! e% V4 M$ e% Cstmt=conn.createstatement();, z2 w. \5 m) j( w D( R' |
rs=stmt.executequery(sqld);
, N" D) k7 x$ H9 U+ kwhile(rs.next())
1 h6 f* V$ H& o$ u0 ?- Y0 u5 r( R{1 _2 H7 O# m: c; D6 R- d
%>3 `$ A, `6 `) [# ?" f) F9 \/ O
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
2 n* @4 q& a6 z p9 |- w2 j' s<%
2 i3 N. p; v. S, L$ k" A: N}
% D2 U Y# j) c" k6 S%> - v- h( J! C# S3 ]' r
</select>5 m8 ~# _# e* [' F8 p
</td>% a' { ^; k7 L( G2 ^+ T) ?
<td>
! `* r4 S4 l8 ^9 T <select multiple id=city style="width:150;height:200" class="bgc">% l% q" X+ s1 h
</select>
: @. y# s1 g* ?" S4 N$ G G' Q) g</td>6 }/ b" K$ {; Y) \8 j+ p, S- `
<td nowrap align="center" class="bgc">
5 X. x- V7 g" P <input type="button" value="<<" class="buttons">
; v# p' m5 `( @# B4 e. @, T <input type="button" value=">>" class="buttons">6 Y! }# T1 w# C! ?4 i5 r: m
</td>
9 f1 V- ^- T, G <td>
" m$ K8 j9 I) d7 ^* ~: k <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
" F0 a- G( r& q& P, y1 ] </select>6 ~9 }* @: B c7 v8 y& U1 W
</td>/ ~5 a5 i6 l& a. K2 j
</tr>
o7 s1 D/ }" p <tr class="bgc"> * y" I& T5 B, S6 ~6 `* B
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>! A" C* Y b" r6 P
</tr>+ P& \) a2 o' i& h/ A
</table>
# X$ L6 {% A! P& t: d</form>; B- Z! p# O) w" N- P
<script language="javascript">6 ]2 _& A( w/ r4 H7 T
//人名移动/ p* J2 M' {+ Y& z7 x
function move(fbox, tbox) {
5 H9 D8 ^2 u" Hvar arrfbox = new array();
' z- i% c& w+ D9 r' k+ jvar arrtbox = new array();
, H9 {8 U7 Z x1 h% Q8 Hvar arrlookup = new array();# D7 d* l: C+ S% t
var i;1 [5 S. l& S+ F) R0 o
for (i = 0; i < tbox.options.length; i++) {
+ n5 @. S& N$ Jarrlookup[tbox.options.text] = tbox.options.value;5 m" W4 T1 B) ~# V3 h- F
arrtbox = tbox.options.text;$ C) V. `( i8 I6 Q4 y$ d, [6 C
}+ ?& _2 N5 g e* @# u' ^) Y6 W
var flength = 0;
3 h% }$ A, d) @, I$ J* avar tlength = arrtbox.length;: x8 L# }1 H9 [! _; v
for(i = 0; i < fbox.options.length; i++) {
% e& ?$ R5 w, Garrlookup[fbox.options.text] = fbox.options.value;& k9 m/ K5 G; F
if (fbox.options.selected && fbox.options.value != "") {
: d# P5 ]4 C8 V1 C- Larrtbox[tlength] = fbox.options.text;
8 c) J$ ~# M$ r/ c) U( d4 d$ ttlength++;
0 f( l& C! k' n$ E! j}
8 w; Q- x/ L( i$ s o+ _9 Jelse {
7 O7 o9 ?7 @5 X4 l; x7 Darrfbox[flength] = fbox.options.text;
' {8 j2 _$ }3 \8 x: }1 @flength++;
. R% g1 l- F% k& n) o2 A- I }' e% O) M: x8 |- ~! V+ \1 Z0 K3 N
}- U2 K- ~" Y* Q% y2 r/ D0 L
arrfbox.sort();2 u5 u' }4 G4 ?5 w2 P, T
arrtbox.sort();% E7 H. d) d& C! d9 I- q% {- P
5 _- }- V1 Z% z1 k& }; R5 Efbox.length = 0;- U' k2 Z: H6 N9 x7 T
tbox.length = 0;2 f; D2 _0 \ u: x
var c;
1 H5 k" p# O9 V; [for(c = 0; c < arrfbox.length; c++) {& \$ D1 ~! V4 `0 q. S) W+ x; K
var no = new option();5 y! `) `8 U7 ~6 C5 n$ }0 W
no.value = arrlookup[arrfbox[c]];$ R* l v* m- R# A4 K9 T0 e
no.text = arrfbox[c];
, ?( O6 u: W& ~fbox[c] = no;
; U4 @2 W! Z% m7 j z! B3 C3 p}- N5 c' s: i) f8 z. Q
for(c = 0; c < arrtbox.length; c++) {5 ?6 m" F. ?; u( M
var no = new option();
! O! D9 s/ P# L1 O8 ?no.value = arrlookup[arrtbox[c]];0 P9 B& @' A5 ^6 e
no.text = arrtbox[c];. l9 O9 e J) _1 w/ X
tbox[c] = no;1 t# h. [5 E& {& r8 x! p
}
2 N! ]0 T' M+ }}: U9 z% {# _6 v5 e; `+ Y& F
</script>
: F& |! ~/ A0 O2 Z</body>% p$ }4 j" f( r5 ?( W* o! c( o
|
|