|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14443
- 金币
- 2507
- 威望
- 1647
- 贡献
- 1455
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"5 c% m% f# L, I# y9 p# ]
c pageencoding="gb2312") Y+ O$ l) b8 m$ H) ^- l' h# h) z. L
%>3 J- D, m: `/ |- k
<style>
/ @2 [7 x$ G+ { h.f9{ font-size:9pt; }
" x% G/ G- Y2 q: \: s.bgc{ background-color:#aecaf9; color: #0033ff }
3 D$ Q4 f+ I/ `1 x) o4 L+ d.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;8 r% p/ Q$ ]7 B6 [: {; c* O
border-bottom: solid 1px #4e7dc1;0 G) e( B5 p- Z5 `
border-left: solid 1px #aecaf9;, `) _1 V7 I1 `1 F1 s `! d) K$ a& N# O
border-right: solid 1px #5679bd;, Z$ U% W8 I/ f$ e* C
padding:1px;
5 F0 p' r8 J) L: ~ margin:0px;}
( p' y' G; z! G+ L3 B; i/ B$ ^</style>8 U0 {5 S% k7 X6 V' F
<script language="javascript">+ a. Z& G ?4 q, t4 f7 E
<!--+ |1 w3 B; L& ~8 [
function rv()1 E& v8 J' D& N( z, u
{" B) X5 y* M9 }3 k, k+ n
var val="";
1 C, j+ Y- d6 d0 O for(i=0;i<combo_box.list2.length;i++){
$ F6 W3 A* s3 z0 \8 A. O- z$ J val+=","+combo_box.list2.value;7 Z* R; \ ~2 Q) N( Z# p
}
* B' q7 m! E/ e8 F+ N j if(val.charat(0)==","){
; q& ^9 \: n! | F! C' i val=val.substr(1,val.length);3 I9 h1 L! i: Y; f' j. B
}
$ A6 n6 Q3 H) L9 F- _0 ]4 q' X opener.form1.frecname.value=val;
G4 M8 m4 e! _) r" Y1 F self.close();7 @1 }: R: g& e" |
}
" F% u6 L6 y `9 }9 s//-->
9 \- V6 p- Z" Q f- o4 U2 s/ W* n</script>; h* |1 X, R+ }* A* m) ^" W4 S
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">9 T# S1 Q( W8 c/ D$ i
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
$ Z, t. U/ w+ F" S<%
* l8 ?& t& h$ Y2 W, c' p cdatasource ds=new cdatasource(); //数据联结bean实例
% V* P% r* _# `/ u* ^1 `& w java.sql.connection conn=ds.getconnection();. I/ t+ s( v2 T7 O1 m: ]2 S5 [
java.sql.statement stmt=null;' W% b, U6 g x2 j* S
java.sql.resultset rs=null;+ J) m2 u3 A) N2 T! V& o
cdatacheck dc=new cdatacheck();
8 p1 Z2 @9 P# r. t%>
# r4 _4 Q, \) w% V% D<%
& E2 Q" Y) l+ u+ y1 mstring 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";
0 E8 [1 Q, I, n! O4 P# l$ X. mstmt=conn.createstatement();
5 S3 S2 p0 g5 P& ^' ~( f7 krs=stmt.executequery(sqlu);
7 F ~4 ^) }6 [3 I%>
7 J! R2 v3 |9 U- d0 s<script language='javascript'>! j0 x! [6 S6 [) ~/ z
arr = new array();
+ v3 k% T9 ]9 ~& P( B C4 U Z<% int temp=0;2 i3 t: p5 k8 d
while(rs.next()). n2 A/ D. b- U" R' J
{
$ |- V2 K0 g3 h3 ]%>2 u0 K6 e; p! V' u
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
' B- Y" _6 e& R; k& a3 @+ K/ S* h<%
) s8 F- Y: |% M* Rtemp = temp + 1;2 ]' V, W9 a# W) Y
}
: Z( B6 i4 U. d- _, A) f%>- N+ T$ J# s8 z E, g0 g
temp=<%=temp%>;+ h8 M, U- s2 O% J- m
function changelocation(id){ : o) }9 Z7 D7 x" E1 Q
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
8 o/ d, ~6 e$ U7 X4 zvar i = 0;
9 J# E/ D2 B; G8 [0 l- _" n8 `document.combo_box.city.options[0]=new option('-------',''); + r. S4 c% w" w3 h W% E. F
for(i=0;i<temp;i++){ 0 x1 ~- ^: ^/ h, I. L6 S4 e4 p
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
9 o4 \ D: k) X, w, Jdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
; [9 h1 n! ]! L' P7 S}
9 d$ U" y$ X: Q, [3 q+ M3 v}
3 @' s3 b0 A1 i: S3 e4 H} $ L: O. R4 |6 E. q$ u w& ]- S/ R1 |
</script>
! a; S: M, Q* |
% l! F* f# d; z/ `2 U5 ?<form name="combo_box"> v: y% |6 y% K; w3 v
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">' [' U! ?3 P6 M0 r
<tr height="24">
T8 S8 M+ C# {+ o' y5 @6 h <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
, H; R& J- N% T8 J <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>. S* `$ q& e, D- N$ |9 B
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
) l) S$ Q5 a8 f; y <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
5 L- f0 a& I* c </tr>
7 u! J1 E7 c0 o0 C, ?, c <tr> 9 v, y! _' k& K5 }+ m; ^ N- I
<td>
1 s% @$ J+ B$ h5 f4 _ <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">- ?# a5 W% B$ Z5 [* A5 Q. O( Y. D
<option value="0">请选择部门 ---></option>
5 K4 [# ^1 e; D<%8 ?( q. j: L8 W. D3 x
string sqld="select * from tdept";
5 a! @4 p/ { I8 n( Xstmt=conn.createstatement();
: j/ d' w! H1 Z2 B8 h5 drs=stmt.executequery(sqld);: i! l3 Q6 ^& Y& u3 y0 [! W9 z3 }
while(rs.next())
* g0 N5 |# b8 U{; _7 J6 l! _' M/ f3 M7 I
%>
6 r9 p2 Q5 q! H' s <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
( d1 C3 ~. i! S8 f; n<%
6 @. r, C5 D# i, F. ~, `, X/ M}/ Q. W* A0 _6 G
%>
& G2 m* [3 c/ j </select>. J7 `- b. B- M' K( S
</td>
2 r; @* Q u, Z4 l4 A- ? <td>! C5 u! ?' G4 i* G& j4 e
<select multiple id=city style="width:150;height:200" class="bgc">
5 a. [2 @- b( i k8 r- W </select>8 ]2 t( V G% b0 e3 Q h
</td>
& [# n8 Y- X" s2 k5 A: @) \9 m <td nowrap align="center" class="bgc">4 a' v* K4 l4 L9 U! D' X A4 o
<input type="button" value="<<" class="buttons">1 `$ S: H# T8 `+ v$ P/ S
<input type="button" value=">>" class="buttons">$ ~; [% R1 y- O# _. `9 c) Q2 q9 r
</td>
# K" ~3 Y( h% _; Y! Q5 x: P <td>
; u3 |) Z @: O! A9 C) H2 Y: R <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">" B0 L% c) l- x% H
</select>% V4 P( L( `6 i( ^ R1 h
</td>
2 ~5 S$ S; p/ x0 [6 }2 d: i* K </tr>
2 z7 p1 \, p8 ^+ g/ H+ Z <tr class="bgc">
/ N% P, ]5 `7 L O, l9 E <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
6 t0 A& J4 `1 A6 C1 g0 r/ k </tr>0 j2 E8 v" i6 P7 p
</table>
$ h# O8 J5 \7 g2 k9 z7 T) Z</form>% C6 c+ S1 B0 I2 r6 J3 c7 e
<script language="javascript">
$ j, @! B- I) I! b" M, W: v) ^//人名移动2 x* s" U4 x' Z& z
function move(fbox, tbox) {
8 ]7 n. U. _& [& \% U Kvar arrfbox = new array();
1 h2 Q4 S, A5 H9 D L M" ovar arrtbox = new array();' r. ~/ ^& `) N; u
var arrlookup = new array();9 M- A% @6 ^) F' B$ S3 T
var i;+ ~# M' D5 V/ W# h( a- ~
for (i = 0; i < tbox.options.length; i++) {
' R& X7 |* u0 C3 d3 `- E' _* o# ] parrlookup[tbox.options.text] = tbox.options.value;0 ^5 ?* u; N% h1 z- R
arrtbox = tbox.options.text;* Z1 v* `- O) u5 L- s/ O
}
3 Z* Y" C& m4 kvar flength = 0;
" E* n7 G( D# Qvar tlength = arrtbox.length;; ?% k' O6 [" d) z9 d6 L
for(i = 0; i < fbox.options.length; i++) {
% ?/ h. g* A+ W6 K' |/ H1 z0 garrlookup[fbox.options.text] = fbox.options.value;
4 N3 U) X6 Z& q4 t' qif (fbox.options.selected && fbox.options.value != "") {- c% e7 w$ X( L1 y* Y9 I9 X
arrtbox[tlength] = fbox.options.text;% a4 n4 u( }; D/ @) }$ v+ \' E$ @
tlength++;
. b- ]1 Z8 B% k0 r! S' S}. i. P7 ^, D& w5 y
else {# C' l" O2 Z; {. G
arrfbox[flength] = fbox.options.text;
6 ~8 _4 P# l1 I- K5 {) tflength++;. r2 o# q I7 e. c& Z! n T
}
0 H0 b- c. ~) u. d( {+ u w}
% s1 h0 s5 Y C9 `; U* W- [arrfbox.sort();1 O! ~# u" I" T1 e* }
arrtbox.sort();/ }. C4 P( r( W% J! p
& o- d! |$ Q6 W1 ?0 y& s" t
fbox.length = 0;
) `% |* Y6 r* Xtbox.length = 0;
5 d G0 f b$ i/ M0 svar c;
7 x+ Z1 B4 Z$ t8 ~for(c = 0; c < arrfbox.length; c++) {
6 c. N, e+ M9 e, \4 @7 Q& I$ K0 N/ V! Cvar no = new option();& Q% j4 A6 r9 G
no.value = arrlookup[arrfbox[c]];
4 q; l# o# {8 n: r/ f# ]7 {no.text = arrfbox[c];: M8 ]4 e6 d, H; B# t/ V
fbox[c] = no;
: M* a% g* k: D6 e}6 v; [0 G+ y) ^' I% X! U
for(c = 0; c < arrtbox.length; c++) {9 x0 `) T! R9 _
var no = new option();
& z2 H! j- o6 ]. ?& Pno.value = arrlookup[arrtbox[c]];
. S1 M3 O, L1 O; A/ Sno.text = arrtbox[c];3 q+ V, h+ K2 n: e/ Q$ `2 f
tbox[c] = no;6 ^, k N/ O- p8 B4 i: l
}7 \/ B* S0 V+ q9 s
}2 u0 Q* k1 e/ H" f3 j' P, T
</script>
2 n+ s2 m7 h8 d; {8 U7 N% Y</body>
; n; Q5 p, i+ i. S7 W8 \# m9 k |
|