|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14443
- 金币
- 2507
- 威望
- 1647
- 贡献
- 1455
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
0 T9 i* q- m# y5 H& h c pageencoding="gb2312"" C) U8 |. R) c& a3 s6 W! M3 d
%> L2 v M1 i& Y: i* N( Z7 j+ L
<style>/ Q2 p7 q* S1 O+ z
.f9{ font-size:9pt; }* s2 k$ V4 S$ G1 T. _3 f d
.bgc{ background-color:#aecaf9; color: #0033ff }& _& q0 N @" ^' H8 p
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;! C$ Q$ R9 g# E4 y7 J9 E9 } S! i# h) `
border-bottom: solid 1px #4e7dc1;
4 }: l1 c: a% ^: e6 _ border-left: solid 1px #aecaf9;
. U9 @3 p5 O a9 t border-right: solid 1px #5679bd;
: N% ^, M9 C8 N5 u5 j: G3 a2 ^- c padding:1px;* h5 ^4 p* X3 q3 z% P& Z3 C
margin:0px;}4 ?. J6 v; }$ u' @. J3 C
</style>
1 j' [! O. ?6 l% G<script language="javascript">0 G& }# H1 |* |; U, q
<!--$ Z( k9 V! X* k
function rv()
" l$ ~9 W3 F- k$ ?1 P{
2 U* e; T% x6 U0 b% C var val="";
8 [0 n% f: b v- f/ L for(i=0;i<combo_box.list2.length;i++){
, V$ M8 p5 \! p1 A" Z val+=","+combo_box.list2.value;! V a$ S e1 d5 G' A/ F; q: L
}( E$ Q* u- w. R: i7 H# d% n! u
if(val.charat(0)==","){
; `) q) g1 A4 R* I$ M: s! y val=val.substr(1,val.length);
( s, F, j- ]- x4 O- s: [8 I% i }
' j$ d% [, {$ M! E* Q7 ] opener.form1.frecname.value=val;
( q6 i2 H" l8 m& G self.close();
. {( I( k }& i}2 Z. {( p: @$ v6 F: W
//-->0 B* W. q- \7 ?" @
</script>
5 ?6 A. D: Y* u* | U$ ^, z<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">! @" \9 E0 u* G8 m
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
8 M) z+ c- O" Z<%7 G- n$ e8 N8 x' E3 r# y' }# `
cdatasource ds=new cdatasource(); //数据联结bean实例' l. B! ]9 x) O0 U
java.sql.connection conn=ds.getconnection();7 t. y/ F8 J0 V- e3 z* j
java.sql.statement stmt=null;
& E( l4 J: a1 g+ l java.sql.resultset rs=null;
1 k7 c4 n5 q! t3 e7 F2 T9 T7 T cdatacheck dc=new cdatacheck();
{- q" n* `. K# ~4 O%>
. a# o9 Z( e0 M5 i& L<%1 b$ G- ]* S$ J5 g2 A
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";
3 P# B P6 u) F) H! ~2 d+ ystmt=conn.createstatement();5 R" |* Z' i- | f) O: B
rs=stmt.executequery(sqlu);
0 O; v1 e V) Q( t0 A%>7 a9 o+ G0 _$ j# T0 k* D4 o
<script language='javascript'>, o) V! m& X+ P& k: S+ O) ~
arr = new array();! j& d% Z+ u( {; G+ o; ]" V- z
<% int temp=0;
9 G ?# R0 I- O7 P' a9 f k/ B( {while(rs.next())5 |7 M! F8 u* G8 |2 L- A7 Y V
{; V6 m4 k( o6 J+ ]
%>$ f; n7 m H1 H/ A; Z3 J, I' i+ H
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");' O6 _7 U8 Z# g0 X
<%
3 c! z- ^8 T. L& Ctemp = temp + 1;/ t- W7 r- B( D: B2 e. w
}) j' Z* F3 \+ K7 w% j& X6 q
%>5 ]. S4 f* U- f( f+ w
temp=<%=temp%>;
: l4 p& @, r7 K3 vfunction changelocation(id){ 3 b3 z& W; H `* @* d- ?! w7 p
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 4 W8 y2 U Q$ O# y
var i = 0;
: V' o8 j, X+ Xdocument.combo_box.city.options[0]=new option('-------',''); 0 N6 F4 ^) z5 H7 D _
for(i=0;i<temp;i++){ 8 O& n0 L3 w' J0 E& o
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] w3 o- ^3 l" \2 h0 i9 G: U' h
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
4 R8 d; A% z( C3 T2 P} 8 |' U% Y5 F0 s% S- N( `
}
. O P: d( K+ o( Z} 5 N$ g1 Y; v" j
</script>8 q: `% K, S2 U/ N
0 u. j* E" u* n6 s<form name="combo_box"># v/ |8 j# z( \$ D
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">7 b8 w2 X! |4 x" ? ~7 Y) i0 C
<tr height="24">/ ~! K) z# ^3 F
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
- J! h [" r: O& P* H6 n <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
$ w: A1 `- e: ~6 u6 z) K" E <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>* w, V7 u: M" O! o9 W
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
: o; |( ]4 R. s2 U) p </tr>
3 P) d4 d3 c$ G" R, W4 u* X+ B <tr> ' q5 [! }! O/ g
<td>
. o& ~7 K( F' O5 ^. e- j# G! F <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">; E; \1 [1 H* P" K/ m
<option value="0">请选择部门 ---></option>( N7 K! T8 ]* L2 y2 J7 j
<%
$ [0 u& \- u4 C6 C9 u+ O string sqld="select * from tdept";( [; R( f( y; ^
stmt=conn.createstatement();- C8 t0 k6 K4 H4 k% S, i, _
rs=stmt.executequery(sqld);
+ _& Y) p% I F$ Z9 ^: Qwhile(rs.next()) O# @7 Z0 z. d
{$ [7 z$ c2 w' M% z5 G* L
%>& {9 X- R; j1 i' l4 c! b l, ?
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
3 ~0 Y& {2 O# A6 J<%
# I# G# h1 S# I9 y+ ?}
+ Z+ { \0 {& F. t%> 1 \" [5 T2 G1 a1 @
</select>
! A' p* B7 V8 M J</td>4 g( c& D: M" d! r
<td>
0 q7 M3 `& P3 G: }6 h4 X <select multiple id=city style="width:150;height:200" class="bgc">3 m: ]% M9 A" ~- A9 W; ^! g
</select>
7 G6 a: q9 U4 ^) M+ Z! l) B: E) N8 j6 l</td>) r/ b; Q5 O7 x$ v9 C
<td nowrap align="center" class="bgc">7 {" M/ K9 @8 \6 l
<input type="button" value="<<" class="buttons">
5 b& q0 p; `) C( P! h/ g <input type="button" value=">>" class="buttons">
* N- I! X2 v: V+ d% ~; S B& [</td>
5 ^9 J6 l% O2 D! q" {3 B% v! g <td>6 c5 |2 ^1 S% ]& x8 K" [ w3 E
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
0 G J. B/ `. @ </select>
h* \8 l/ x4 o, c( G2 k; i</td>. [9 w; o+ ?! k. j5 k6 l# f
</tr>! }8 e( }! L: ~, a( S$ T
<tr class="bgc"> - y: t- X/ t1 q3 g5 z1 S
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>: u2 T6 l q c( X3 p
</tr>
# Q) L- h3 O7 `% ~0 o</table>
5 U& T) }2 T3 Q5 U( v0 b& m</form>
8 F" r1 ~& d8 F$ v& r5 x$ r<script language="javascript">
/ H# j5 @- a" c' { T7 D//人名移动
/ d% b4 H. I" h0 gfunction move(fbox, tbox) {
. B6 C1 X, c# E0 I& n1 ~var arrfbox = new array();( O) B: A# G! A: K$ C2 S: V. ]& _
var arrtbox = new array();9 y; n4 A) i, N" ?
var arrlookup = new array();
k' w l, J; D T& Q5 Y- p9 @var i;
2 _+ c1 A" W$ z& N2 c8 k# Wfor (i = 0; i < tbox.options.length; i++) {( F, {. m7 I" v4 V
arrlookup[tbox.options.text] = tbox.options.value;
" f4 a& q- e; W3 |6 Garrtbox = tbox.options.text;& B/ o7 P5 T, }/ }+ p Q
}
, Z! P* J8 y; n1 S- R+ Wvar flength = 0;- A0 b, z! Y Y
var tlength = arrtbox.length;
1 ?5 r h! R& u6 |' ^3 Nfor(i = 0; i < fbox.options.length; i++) {
0 q- G" m2 F, @arrlookup[fbox.options.text] = fbox.options.value;4 ]4 B* {, f$ e: n- B3 d2 u# J
if (fbox.options.selected && fbox.options.value != "") {& p/ q9 s1 x3 ~+ K
arrtbox[tlength] = fbox.options.text;
* H/ |1 ], i" g6 j. k$ X% utlength++;; z5 @' b$ Z1 e" G/ b/ H
}
) Q3 P; s) Q2 Pelse {
: q* N$ p% h& E. k; }5 Z5 garrfbox[flength] = fbox.options.text;
" f0 l% C: i9 T2 nflength++;
# y& h( j6 U$ u8 ?/ | }
) N* y8 M. O* R: N4 \5 X2 U; W' z9 `}( k* X; K5 j3 |1 ]7 S8 }3 o# N
arrfbox.sort();
- ?8 k! n/ h9 C% T! \" harrtbox.sort();
0 O' ~8 h/ U+ V) Q' o8 E6 P, k6 [% j1 R$ Y, A: J" b1 | X2 B& V6 V
fbox.length = 0;
( `, r/ p9 \- W4 O1 y+ jtbox.length = 0;
- @- E& \ b3 Z0 Tvar c;
" R( F* t7 O4 Afor(c = 0; c < arrfbox.length; c++) {+ P8 o( z6 R& B
var no = new option();
. T% f! A) z3 p5 G) i, i) H- E! ^no.value = arrlookup[arrfbox[c]];
1 a: l( Z6 F; ]% o0 d% Ono.text = arrfbox[c];8 N9 K U( z8 T/ z+ c
fbox[c] = no;
. H) ]: b. P3 F2 d+ q0 u/ c}
+ ^, d. _$ D* }- rfor(c = 0; c < arrtbox.length; c++) {
$ y8 p3 r X# G qvar no = new option();
% w( H5 L" k; p4 G, W5 G" Fno.value = arrlookup[arrtbox[c]];! d5 u2 j, E. c9 [' y# J& ?0 P
no.text = arrtbox[c];. B1 M, `* @2 T8 _8 H$ ^
tbox[c] = no;* k, J0 u6 S$ @
}% S4 d% n! o7 a$ J" T5 m/ w+ _* [
}5 k/ H2 Y' r! U6 W9 y) D
</script>2 [% M3 h3 Y) T+ Y8 @7 H
</body>
$ [) S. ?& T1 X4 V8 [6 s |
|