|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14397
- 金币
- 2484
- 威望
- 1647
- 贡献
- 1432
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;". d, ^! P: n0 _8 j( t( p
c pageencoding="gb2312"6 N( V/ u+ ]# A0 ]! f
%>
9 W1 T- ?- N0 ^<style>
/ @, r; Z2 K/ c+ s& `1 s$ D.f9{ font-size:9pt; }
( N2 [- G& a! l5 o/ H.bgc{ background-color:#aecaf9; color: #0033ff }% M0 {/ p8 p! k" r+ `
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
7 h& ]) z e$ k. J border-bottom: solid 1px #4e7dc1;
w5 a; g6 F# d* |8 {8 x# |7 c border-left: solid 1px #aecaf9;
6 p/ k6 A8 `- p5 D; m border-right: solid 1px #5679bd;
3 E+ M1 V( b& @$ D; b, a2 d padding:1px;4 z3 N6 b l5 y3 a; q
margin:0px;}
0 q& `: ^( u* R0 v- [</style> G0 {8 Q b+ k- C9 I
<script language="javascript"> [6 {1 m i5 J
<!--
* t/ C2 A0 N& |8 {/ afunction rv()
7 `6 ]# q4 o+ a. {% }{" R/ l- Z2 l5 p7 A$ [
var val="";
% r* G# V5 K) { k$ h for(i=0;i<combo_box.list2.length;i++){
. ^ E! Q, b" V/ ^% Z val+=","+combo_box.list2.value;
) @) R+ E8 p8 ^1 [0 E }4 J' }$ d2 {3 q) v
if(val.charat(0)==","){
/ w2 E6 q" S! v5 b% M& Z val=val.substr(1,val.length);2 O* z! @3 t* T9 g5 H
}8 L9 ]1 ^" b, A" A
opener.form1.frecname.value=val;
; n2 S: e9 B: ? H8 V9 e& v" D/ n7 s% b self.close();
( [1 Y: ~; q# z: ^* W% o: C/ M}
2 A* [+ X/ E: ]7 H* x4 m) Q//-->6 T1 g. d8 S+ ]+ Z
</script>$ l( |6 t! x: d. L6 `* { X
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">& Q' K* \ k) g7 L9 c7 W5 R
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
& ~, m/ B Q$ G7 A<%
, b4 w% J0 w1 n cdatasource ds=new cdatasource(); //数据联结bean实例
- b$ U2 P, \* Z ?% I* ~( ~ java.sql.connection conn=ds.getconnection();
# S6 p) v' Y* l2 p3 d( } java.sql.statement stmt=null;
# P- v& y* b9 g: P java.sql.resultset rs=null;
0 {: U( o2 H3 m7 ?' a$ E cdatacheck dc=new cdatacheck();3 M6 a% o3 N# Z; f2 B( s6 }
%>" K Q8 }! U( m/ |
<%* J+ k9 P' z1 C9 f' A" G. 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";
& D% q; D; ^" o6 o( Y$ X+ nstmt=conn.createstatement();5 [. F: h) @$ W' k2 e* U/ ~
rs=stmt.executequery(sqlu);
; V6 B- c8 E3 \4 o% j%>" \# t: I/ Z# s$ U
<script language='javascript'>
) `0 h# Y7 |3 C r+ _# |arr = new array();. c0 ]3 z( Z, a6 i6 B$ ?7 m c
<% int temp=0;" a4 D; i, p7 a4 H: N4 P: z
while(rs.next())- i8 w% e$ U, P5 @( d9 E- x! T
{1 s6 B& Z: }, w! M4 {1 m
%>; t4 h: j, ? M. p- a6 z: Q. x2 A
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
. l, _' O! c7 N1 ^" j, a0 E<%7 z0 R$ J9 A& P& I3 e6 W/ Y6 Y
temp = temp + 1;
U8 Z( n, _% w0 i}
6 p+ Y, N+ V8 M* F4 b3 o+ Z%>9 R z8 H3 V; w
temp=<%=temp%>;# T; O/ m# V# a, X9 C, U+ x- F
function changelocation(id){ % D& I' _: b/ P" |+ o$ y
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
) a' D( }# ~+ p" g. e- lvar i = 0; ' ?& M8 a; }, C9 v* a2 f; A. v' E
document.combo_box.city.options[0]=new option('-------','');
- n2 r Q0 P- K* vfor(i=0;i<temp;i++){ 5 `0 | o8 P: f
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] 8 n2 l( Q2 h/ v
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
3 ^( g0 N( C- {* u' f}
% C8 z9 w! a$ \4 w6 q) _8 b. N} 8 n- z, d- l0 W, |+ ^9 {
} 0 z! L; r$ M* x& j# X, w
</script>9 ~. m; e2 n1 t; e
9 t0 G& f- _( h5 w' b3 q<form name="combo_box">' m% \4 a$ l) j5 ^
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
1 E H! b5 I7 w4 {* ~ <tr height="24">+ ?/ Z2 O" o8 [% Q7 C/ E
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>! f: }) C! W' ^+ X( y8 b+ |" R1 Z
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>; I( b( A6 f& q; G& ~
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
3 K0 V- d% e7 W2 k! M <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>) b! M5 n# V# _( B7 u% G3 @8 g
</tr>2 O- Y+ A# {' p, r
<tr> 5 y! w0 d2 E9 S7 v/ W8 q
<td>8 V# l# s; ]0 ~, p$ k; Y
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">- W; u2 F7 H# g# I: j
<option value="0">请选择部门 ---></option>
5 _; J$ I. Z/ H. [<%5 c0 U+ q; e, O+ D( r
string sqld="select * from tdept";
* _1 j7 J" O) t" A u, B' Jstmt=conn.createstatement();
% I7 @ E5 O7 e- j: H& Ers=stmt.executequery(sqld);2 _* }3 K1 O% }1 \5 Y
while(rs.next())2 b( y d( F( X, }# G
{
! O9 h) M2 M: l/ P o3 P( l%># O6 e o1 [8 Z4 q$ {
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
$ \! S; W; J5 W2 g1 m+ S<%
l3 r) Q! E4 r4 z}$ G* v; Y: f3 A0 o2 P0 j
%>
3 [* f: d' O. ] \ </select>
& Q2 x- `) k) ^& }8 ]" d' W</td>9 H3 X7 V) z0 A; F2 Q
<td>
) W' T+ f* |8 J+ g& t <select multiple id=city style="width:150;height:200" class="bgc">, v, O/ ]3 B$ @& M
</select> n" L" z3 ` O5 m+ H" u
</td>
) Y/ `8 Q" r# r& y <td nowrap align="center" class="bgc">* v/ o. R ?2 \- C( T8 `
<input type="button" value="<<" class="buttons">/ c& o8 i5 d% q4 r8 R
<input type="button" value=">>" class="buttons">
! \3 k, y- s, J# W! a" @: y</td>
% y w4 ~# O' O8 v# T8 q <td>' _# {, n" {# y& ]7 A
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">; E. ]2 Q/ @- m% z, O1 s
</select>
8 t8 Q0 [; X6 C* G+ \9 H: o3 a6 o</td>, \3 I- P) s. p+ C3 \. T/ _- ?
</tr>7 w$ h! Y6 q9 e9 p& P5 Q
<tr class="bgc"> 7 H" H# G- `+ E# M% T
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>' G" `% f- ~6 i" b
</tr>9 u- R, O$ Z. H8 @* \5 ?* q5 s
</table>
' r: l, v8 U1 X2 t8 b/ z9 K</form>
9 b( j* b {5 n: b4 ]5 R: r4 @<script language="javascript">
, u2 A- c6 J9 y/ N- }% b! @//人名移动: f& t! n1 |- M" I; S m2 r% a6 R: b
function move(fbox, tbox) {& i) s0 ?: t- l+ a" D
var arrfbox = new array();
! j" [, f" ?& E! Lvar arrtbox = new array();
- V3 L4 T( u j2 nvar arrlookup = new array();! m6 |- h4 W- u" \
var i;' @0 g0 h4 W% e$ F" \
for (i = 0; i < tbox.options.length; i++) {$ z W# v( k) m6 O/ _ E" w% ?
arrlookup[tbox.options.text] = tbox.options.value;
# y- F, a. y1 ? B( y6 Aarrtbox = tbox.options.text;
# y+ ~3 h1 D2 g' A$ s' t}: ] _- i( {5 K' I. E f! g E
var flength = 0;
; f' i* ?5 W- C/ c: j, hvar tlength = arrtbox.length;
7 n& M) f2 N' L3 [8 Ofor(i = 0; i < fbox.options.length; i++) {% B1 T9 R; X' v* o- n/ l+ A/ o
arrlookup[fbox.options.text] = fbox.options.value;. k* ~! k+ D: @: d( H
if (fbox.options.selected && fbox.options.value != "") {
3 `( o% o2 \& f$ p4 z7 darrtbox[tlength] = fbox.options.text;7 R$ D$ D5 x% N1 Z. L8 [- ?' \
tlength++;; \5 @( n+ j3 a! M
}
( O F2 r* c I7 P/ }else {( o7 B9 @( x, O# z8 E, M0 ]+ P2 C
arrfbox[flength] = fbox.options.text; i l: I/ x1 A( A6 i( o2 E
flength++;. S' L- V; ]) V) z7 D3 d9 z
}
+ u+ b# g7 M+ B: B} ~3 |: f% ~" }( H' j6 a+ r
arrfbox.sort();0 u+ Z$ R% W, k. y: j! }0 g+ F
arrtbox.sort();
7 r0 K1 {0 S ^, g$ T( @: u! i6 V1 V0 b; T
fbox.length = 0;6 m' r5 b3 o1 c- R% i
tbox.length = 0;
6 X5 v3 d7 N* u0 g- s- o8 Z- I3 gvar c;7 T: i# e+ Y" a' t4 U% b* l3 w% T1 V
for(c = 0; c < arrfbox.length; c++) {' Z" \) d; p C' Y8 v
var no = new option();
. l z, W& `2 D% E0 Kno.value = arrlookup[arrfbox[c]];
+ Q* [' ]4 Z T& w$ w$ Y- F& i8 ?+ Uno.text = arrfbox[c];
) o, z$ a! H. R m0 Zfbox[c] = no;
, ~6 m4 W6 U- [7 H% ^ N7 L}8 `$ n$ K( j. u, u
for(c = 0; c < arrtbox.length; c++) {
4 e! V" Q8 c& e5 i+ Z7 o+ c; Cvar no = new option();
# Y( M* ~# c0 `! r% _3 Q% ]no.value = arrlookup[arrtbox[c]];
# }7 }" u8 `" g9 K+ hno.text = arrtbox[c];9 g" U2 F3 H1 H) }2 u( ?
tbox[c] = no;
' @( H7 B8 r5 P/ N, Z }/ d0 U- ~; v+ _; g# f/ ]: U4 h
}9 O8 }, f g* A% x
</script>
4 E/ g) V# o) A$ Y6 [; i</body>
5 I0 r5 w8 D: h# f+ Q |
|