|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14479
- 金币
- 2525
- 威望
- 1647
- 贡献
- 1473
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
8 q. \) C- C+ {% w c pageencoding="gb2312"
* q; s7 |; K& d- R$ h4 H. v%>$ [0 I7 U; \% t" @5 j, j3 n
<style>6 v: \1 m2 u5 W8 e% i% O7 y
.f9{ font-size:9pt; }6 a0 X! Z) t* M
.bgc{ background-color:#aecaf9; color: #0033ff }) g: l: T! Z7 t& x. X' F
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;1 v* T' Z3 \' }! H- Q5 f5 {
border-bottom: solid 1px #4e7dc1;: ?' X) g4 ?* g
border-left: solid 1px #aecaf9;
0 O2 ]8 d0 X2 ]5 {6 R border-right: solid 1px #5679bd;. g0 l1 w% v6 C
padding:1px;2 w- u4 f( k" F% g1 c( ^
margin:0px;}2 D/ [2 j. s- g0 ~( G8 w
</style>
2 h$ g7 ]# D. i, D! @<script language="javascript">
1 p2 G' I o3 B% y<!--
3 ?- |0 m+ _- b( R; p% xfunction rv()
+ d+ a; f% F( g3 J0 w( ~! f{
7 a9 H) j& b4 P z) I var val="";
+ @& E+ u# C! L! U/ f" Y for(i=0;i<combo_box.list2.length;i++){: P+ w9 q$ V0 v, P
val+=","+combo_box.list2.value;0 q0 A+ D+ x: ?% _
}2 ]* e% F5 \' l; q2 K1 b- p& e
if(val.charat(0)==","){
* K4 A) J; v3 d val=val.substr(1,val.length);% s0 S* K) I6 L* {3 W: Q8 F9 ~- c
}
$ G/ J6 `; N/ p) B% J opener.form1.frecname.value=val;
1 s2 u# R( k$ G: ] self.close();- u- B1 g4 N6 v1 [9 K6 F6 U
} i# L/ b% s. b f
//-->
" X% D/ q/ k) a5 T, a0 V</script>
1 C( _' ^$ ?, k. r! }$ A4 q* ~/ h<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
; M- \- o1 O, g& {3 K! B<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
0 _& y$ g7 \- D& R8 M<%1 m0 b( `9 e* K2 [" j8 {; u
cdatasource ds=new cdatasource(); //数据联结bean实例+ I4 i; Q* ]2 k. `) A
java.sql.connection conn=ds.getconnection();
! `! O, ^0 D- T( t7 H java.sql.statement stmt=null;
! N$ C* }& Y$ \) Q* g+ T java.sql.resultset rs=null;! x- R5 S. l% ]9 y( X! G
cdatacheck dc=new cdatacheck();
' L0 k6 x: I9 q%>' [* `5 @1 _2 W
<%
7 A% g; N r2 I( Z; g$ G; U6 {6 ^: Lstring 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";
9 W9 c2 T9 ], l8 \& ^stmt=conn.createstatement();4 |9 E. H5 p, X9 X' L* k9 [& r
rs=stmt.executequery(sqlu);+ a3 F' }5 C* W
%>( r: Y1 R$ U0 d$ S
<script language='javascript'>. k- g* G- M# U& s5 c
arr = new array();
( X& x7 {" l, B' ]<% int temp=0;
, ]6 s) t/ |/ c+ u- m; ewhile(rs.next())
% s$ m$ p$ _" I* A{
; K1 L8 q# E+ m; i* i: L$ j%>$ g, p3 b$ n) I* H
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
x" E% k, M# r8 I# o$ j<%6 B0 u: R# {, H) q- K0 [* z% l" r
temp = temp + 1;
7 s4 [% M( r; x0 u# x/ o: U}6 O" K" L9 s" j- H
%>7 ]3 R$ k) d/ K2 ~7 g5 V
temp=<%=temp%>;( I" r8 u0 ^% Z3 L+ X
function changelocation(id){ ! r+ [4 Z% ]) f/ A6 @# P& ~0 \
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 , v* f' y: v7 {7 o; @- {. M& p0 g
var i = 0;
g/ J$ X$ g* m* h3 [9 Xdocument.combo_box.city.options[0]=new option('-------','');
/ B6 q9 U) s, D# ^" ~for(i=0;i<temp;i++){ ; z- @6 {6 C h k9 V1 y+ @+ z) d6 j
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
G/ i3 [% \( S6 k6 s: I4 s' F- qdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); ) X9 } J* X' W9 N0 X
}
* L8 W# q4 p) p. W6 J# N3 B} , z$ I# x8 N! M0 j, f9 }
} 8 O* D& w! z5 j+ W6 I- A2 s ~9 }
</script>
0 b1 k$ |* ], j( V5 X5 n8 j7 _ |5 A! P: t0 V
<form name="combo_box">
1 J: [7 i4 ^7 k9 N6 z<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">) E- r" N. C' q. q" }
<tr height="24">1 D( w. `; q' t
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>" B& U2 Q* }" Y
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
5 x' s, u3 ^$ k2 C' E. V' Y6 B <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>$ F( r3 N4 R+ y& Q
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>; r1 G2 ]/ R. Z% T
</tr>
! p1 X5 o+ R' P; b" f1 C <tr>
' [! `1 k. i0 F8 V# ?8 L <td>
+ j( z7 E8 T2 d$ S) E l <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">4 f0 m. e' v1 C; o3 y7 z" a
<option value="0">请选择部门 ---></option>5 b; f, \/ c5 b/ y/ E
<%8 v4 Y9 Z/ Y+ U' C4 B2 X
string sqld="select * from tdept";
" e; ~6 }- c, \8 v6 s! Bstmt=conn.createstatement();) ]- A' d9 X8 y8 O' h1 J3 }+ V
rs=stmt.executequery(sqld);; M- m: r: I( |6 b& u% `# \
while(rs.next())" Y# m e3 Y$ g3 B! Q7 s% ]1 E
{
4 F7 @& N1 O, o& L+ \5 s: R& g+ K%>
8 f; G$ Z& Z' U# N6 `/ ? <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
: g8 v7 f! P1 _<%/ g4 N- O' s% Z9 P/ B% [
}0 y c! _+ D7 t# r g1 P
%>
* Y/ s8 y# {# t# E1 z </select>
0 c t9 O& j" K( l2 O P0 u</td>
( a# F3 c; H9 D( {9 t <td>
, t) D/ y4 d f& C$ @4 w <select multiple id=city style="width:150;height:200" class="bgc">7 A( U/ p4 p; \4 s; @! H: Q, {
</select> a0 F) @* @ K+ N! w1 c0 a C: G
</td># j. r7 @+ d+ T5 y6 K
<td nowrap align="center" class="bgc">) A1 S1 s( G- _. `% ? d9 o- h
<input type="button" value="<<" class="buttons">
/ |- s- k0 @2 F& R <input type="button" value=">>" class="buttons">
q& \: |7 p4 I0 j</td>+ ~; q1 u0 L% \
<td>
7 @& n, K. t* F( L0 g <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">- M0 F& ]. u9 x* f* ?
</select>6 J0 J/ ^# k4 ~7 W0 _6 G
</td>1 K3 N/ {, G( D
</tr>5 W6 s$ P! F! s7 O8 O2 _
<tr class="bgc">
/ d) a- ^3 O, R5 F7 X: C0 A( ?. `& `1 P <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>" d3 a- ?- g* |, I5 q
</tr>
5 q' a' }4 L1 k9 G& b& ?2 ~</table># i( a, C/ f8 b
</form>
% {! m. [9 j, Q+ }, U. E<script language="javascript">) h2 I+ k4 j( y% _4 ^
//人名移动
3 W ?$ }, _0 r% qfunction move(fbox, tbox) {
5 Q3 v5 M: h# Lvar arrfbox = new array();- z; n- x! V, ]. ^: y
var arrtbox = new array();( | Y' A! C" ~% i! S3 L! U) v
var arrlookup = new array();
& M P8 O4 O! n8 Y/ P2 J8 ~6 B) N- S2 Bvar i;
$ Y6 k+ |) A+ n, gfor (i = 0; i < tbox.options.length; i++) {& {! S& o" u. L G. Y
arrlookup[tbox.options.text] = tbox.options.value;
4 x0 w# M) p4 I1 @arrtbox = tbox.options.text;
* Z: X5 c5 g: H- }1 C}& p$ p: W! }- h; u
var flength = 0;9 `- Y3 W3 e$ ?: ?4 u6 ^+ h
var tlength = arrtbox.length;
5 n# k( o. `3 z3 d0 u) Vfor(i = 0; i < fbox.options.length; i++) {5 o- G6 l6 v9 G" y' w- U7 g( D, j
arrlookup[fbox.options.text] = fbox.options.value;' j& z& L% ~/ }. I' K, o0 X& ^
if (fbox.options.selected && fbox.options.value != "") {5 v) a/ R, X0 E% l# Q2 b9 a
arrtbox[tlength] = fbox.options.text;
i( U1 Y0 Z: O) G+ ntlength++;1 O7 V2 X1 }! ]6 Z: F
}
: w9 Z- _1 y3 S$ relse {4 @; W% X: `/ c1 y
arrfbox[flength] = fbox.options.text;& g" A2 I" y1 h$ w
flength++;
7 h- A/ T$ R' Q( ^" m( [ }
9 f3 g8 w0 N6 I# z, e} D1 u9 P$ P. E7 m( R( D% w: P
arrfbox.sort();5 \" g* x. f+ H& H u3 o
arrtbox.sort();
& ?+ n2 A. u+ |
9 Z r& t$ T4 M4 h9 \fbox.length = 0;
& _( Z8 K, G5 t/ Q* y- G- ctbox.length = 0; T9 ^, Z" c% E/ ]6 x1 @: n
var c;4 ^" J: F+ k! A/ Z" f9 z
for(c = 0; c < arrfbox.length; c++) {
2 ?1 K0 @6 n8 Evar no = new option();
0 S# a3 f" L$ R9 a# n' `no.value = arrlookup[arrfbox[c]];
9 u% s: h* _' c7 F4 ino.text = arrfbox[c];
) T' U- i, V C9 Dfbox[c] = no;; G+ J: t; I7 q# [
}9 G) p9 R* e6 g$ S: h
for(c = 0; c < arrtbox.length; c++) {0 u$ j; Y2 ~% Y. y9 p, n' S
var no = new option();
4 d. `4 o$ V2 jno.value = arrlookup[arrtbox[c]];: `& Z7 {! M& s* e. c W
no.text = arrtbox[c];5 d4 g5 W+ n* {" k8 w1 b. W( k% e
tbox[c] = no; k! u: j' ~( ^ }
}1 s0 m4 m, {" T9 I' n z
}
' @( Z# w3 G1 U0 {; [3 ]# w- a</script># ?. U( Y' l( h& x
</body>
4 C9 }$ V+ f( r# ~1 e( h( j) ? |
|