|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14333
- 金币
- 2452
- 威望
- 1647
- 贡献
- 1400
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"! u/ L! V! P9 N
c pageencoding="gb2312"& U" u' l6 C: z1 ]- ?2 q/ ^
%>
; A/ g7 n* Y4 ~$ s6 h<style>
1 \, P) ]2 y# V% e' [0 u4 H.f9{ font-size:9pt; }
3 S+ a' C! a+ z& D/ N1 ~ F4 N& L2 H.bgc{ background-color:#aecaf9; color: #0033ff }
! J. o- u4 b4 ?6 Q. \8 U.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;, z+ f5 j. _" a0 X
border-bottom: solid 1px #4e7dc1;$ O* }! r+ j2 [+ P9 Y W0 D2 z
border-left: solid 1px #aecaf9;
* [3 k. W9 i0 W, A0 [" o% D( m+ A3 Q border-right: solid 1px #5679bd;
: s% m, _) a2 |- H- G1 h. z4 d8 ?, o" w padding:1px;6 @8 T' }) M3 g- a
margin:0px;}
7 T9 [! t# @& d0 z</style>
$ a1 |) L! J- Q' F2 y) M<script language="javascript">
/ U* e0 e9 x" F% m$ {<!--, [" v: |! m: z3 d
function rv()
, Q7 i7 \! T, ^4 m1 D9 e# o9 S{
1 H4 p& Q) {% G, i8 m var val="";
4 j+ ]* _( E B/ [/ s: B4 d for(i=0;i<combo_box.list2.length;i++){! c3 [' k0 i E5 m
val+=","+combo_box.list2.value;
' ^- d9 f) t2 x }
% p# A. I k+ H# y. U if(val.charat(0)==","){* g) x2 y7 s2 v8 f9 l7 O
val=val.substr(1,val.length);
; x7 L6 t/ v1 A2 W }! `' a- f* D" V; C$ P
opener.form1.frecname.value=val;
" u& S5 N# F6 I( |0 I) c5 Z7 K' H self.close();- {6 t; \" W& F: Q+ C6 \
}6 ]0 v/ k, u7 z' k9 J
//-->. U: t5 K: O& W" ?
</script>
8 J7 k" q5 @' t3 ]: h<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
7 }. i' I) d, K/ e& O<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
* ?8 F) r/ ?) v: c. X7 y; P; _<%* f0 z+ r4 r# ~0 w) P# G+ P
cdatasource ds=new cdatasource(); //数据联结bean实例! f# u; y. |9 L! k4 z
java.sql.connection conn=ds.getconnection();9 g- Y5 d5 I4 o* E( {7 r
java.sql.statement stmt=null;
+ r, l/ x: M! z! v4 H- ^ java.sql.resultset rs=null;
1 ^ g+ t, Y7 t cdatacheck dc=new cdatacheck();
0 E% W r5 `/ C; D# c1 w%>
& W8 G6 j- X$ G: {<%) N8 P! z4 B9 d& I" ~
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";1 C" _( M: m" t0 z, f( W6 Q, Y9 K
stmt=conn.createstatement();
9 D) p$ J5 b2 l8 I% q/ ^4 T9 nrs=stmt.executequery(sqlu);
1 S2 T8 M. V0 t4 ]9 g* x; Y%>5 s, H0 L5 r8 e* G) C
<script language='javascript'>
+ @! L4 K1 m# Iarr = new array();) Y: D$ S: J( }
<% int temp=0;
3 Z% R% O8 z( C" b7 zwhile(rs.next()). S: m' a) @! V2 l5 |/ f4 Z5 J
{
9 b: e4 M5 x2 u! E%>
' o! e$ q7 X! D8 A, s6 z5 y, r; barr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
- ]- l/ ^+ Q+ A# a [) O& z<%
1 s6 H! R( Z4 @/ k+ rtemp = temp + 1;
" [5 r. F; A! }2 H) y! O" {- d}
1 w4 {- A9 N0 t4 ^ N0 a%>
@6 C( t' K" Xtemp=<%=temp%>;& [6 U& a: y, |6 B5 ]' [; ~
function changelocation(id){ / g$ J* ~( B" Q3 T
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
4 h& `7 G! W- Y: D' e4 v Kvar i = 0;
. y. t' ~% ^0 d3 ldocument.combo_box.city.options[0]=new option('-------',''); 3 n, b# ?4 D* z
for(i=0;i<temp;i++){ " {" S9 ~) e: X8 e6 I& ~7 a
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
* ^, D4 \. g* I/ kdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
{# U" _" e$ k0 S3 b5 Z}
5 r% w' K" {' B* {2 }1 n} % C6 `9 b0 } E
}
) L9 X( J5 i8 L7 f. a</script>; `1 M" H0 Y! m- l
7 x9 s! Y& P- `* {/ V3 y K
<form name="combo_box">
^- Y6 ]. {+ _7 M+ ?3 @<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
- Z9 ^. ]; y& f) G" l6 P7 I7 N <tr height="24">/ G% ?" D$ ]% Z: ]
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>3 ?' _( v" u r7 m$ |6 V) d9 ~
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
% I4 _' d6 K5 U6 M+ ^ <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>7 Z5 S+ |6 J* O0 m9 D
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
- g4 y* Q/ t' R& L( l2 r) k# ] </tr>( A" q# X& K" \
<tr>
" s- I7 |/ ]" a1 A+ V: M | <td>; ]; a& N' s+ F% }
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
# W! J# c6 u8 V3 n <option value="0">请选择部门 ---></option>4 Z6 J' z/ c5 k) ]
<%- }1 @: q5 v7 r0 {9 N9 @0 |- k9 r; O
string sqld="select * from tdept";5 e1 ]( B& @9 W! X2 H1 g
stmt=conn.createstatement();/ Z+ m& ~: W* K) p8 j( `+ w
rs=stmt.executequery(sqld);0 D. N) F' Y) ^; h$ [4 E' |4 l
while(rs.next())9 O+ W/ i7 {6 V0 n
{
" y0 Y( B& k( _* N# Y! p%>/ f6 b5 X& l% P) [3 H
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>. D% P8 [ O0 v U# F4 h
<%
/ |' \4 @9 r8 }* r9 F, C}
: H( ] D1 \" ^0 O3 m; e0 ^( G7 S%>
6 V# F: w1 \7 z9 `& F) G; v* | </select># |5 c. Y3 N/ Z+ `
</td>
& h" v) U& _, N <td>7 F! X" C0 @+ R9 ?* O0 W4 L
<select multiple id=city style="width:150;height:200" class="bgc">
8 A; c4 g, q2 y* T+ n/ N4 Y </select>
% c9 j- c* p1 X' {% c</td>3 g M1 ?4 Y: W9 L4 G
<td nowrap align="center" class="bgc">
# t/ d5 {- I" Q- ]0 o3 V' @ <input type="button" value="<<" class="buttons">. W( L+ R! G% C, H8 t" F: J) {
<input type="button" value=">>" class="buttons">
# _$ Y. V1 k J; W" m& L</td>
. V7 I: O+ W; J' f, N <td>
6 P4 ^, i: I! P$ U! j0 L <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
+ D% l# t9 V$ h5 i( R( T8 ^ </select>4 Y& E, _2 c4 q: j! d
</td># M& _" j) {6 \' D* O/ @
</tr>
6 o# W( _' p8 W8 E <tr class="bgc">
- f5 c7 G t6 P! G. w <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>; f% d' A' d- ^; x
</tr>0 h5 X" \# |) N6 ]
</table>
& j- e" X0 O0 i7 r</form>
y* \8 i8 M1 ^3 {- f<script language="javascript">
4 @$ \6 L$ k+ ]0 N8 E" a& l//人名移动
( _% ?) ^8 Z3 D4 Q) T; Xfunction move(fbox, tbox) {' X) b2 \# {$ G8 T
var arrfbox = new array();
! u3 w3 V$ ^/ E3 d! e: T/ tvar arrtbox = new array();
& m) a: G4 M$ l) Pvar arrlookup = new array();
' x/ N }) M6 v" v+ \6 i0 \$ Ivar i;; o7 }8 ]9 ~! d5 E- T8 r. y
for (i = 0; i < tbox.options.length; i++) {
+ O7 k r% Q6 Iarrlookup[tbox.options.text] = tbox.options.value; C7 Z* b* ?# p$ M6 @, i& x. U
arrtbox = tbox.options.text;
7 q0 A" ], Z3 @}: I+ r5 {, b9 g/ X0 V
var flength = 0;0 ?% z8 j& N% X7 C
var tlength = arrtbox.length;
+ A! @0 x3 a1 e. jfor(i = 0; i < fbox.options.length; i++) {; y7 n% m. F6 R5 Z0 ?8 a
arrlookup[fbox.options.text] = fbox.options.value;
# u8 j" t- `5 R" }if (fbox.options.selected && fbox.options.value != "") {
7 I- u P% K3 } f9 Harrtbox[tlength] = fbox.options.text;8 h6 |+ t/ Z, J. S/ u, b, E
tlength++;: O a1 E! g/ j1 [& ]8 a
}
3 L1 F3 T1 Q8 y; I, b- q+ Uelse {
6 c! c$ A2 b6 j+ P7 B5 n/ Yarrfbox[flength] = fbox.options.text;
9 D- w2 x1 r! t& F$ M' ?7 nflength++;
# ?/ ]2 q5 k" M- } }1 G; t7 n) L* }- r2 Q5 g. x
}
& B! x& {/ W* |! r( Marrfbox.sort();2 W/ Y7 x' D* U" o
arrtbox.sort();1 K# p/ k1 g8 U
2 y- b& I* O8 m9 e8 l Cfbox.length = 0;
& q+ y0 i$ m6 q! E) f" w, ttbox.length = 0;
* z' V, }/ k" P0 u; S( S' m, l, |var c;! X, f" `" [+ h$ q U( l9 ?- A
for(c = 0; c < arrfbox.length; c++) {
. o4 c0 w% g( o' ^$ evar no = new option();
6 l$ y$ j, Z8 V; R6 i7 [3 }: \ fno.value = arrlookup[arrfbox[c]];
' [% f, [7 H$ b9 n& cno.text = arrfbox[c];
6 e- Q4 r5 r+ E1 j8 d% _3 {: Xfbox[c] = no;$ E) m* d# x+ F- [
}' k8 {! m1 M0 C7 }1 s: M; u2 _ f. u& N
for(c = 0; c < arrtbox.length; c++) {
5 M- b1 W, F8 N0 A3 lvar no = new option();
+ i: T/ j$ p9 v) z( D; |( @. H5 nno.value = arrlookup[arrtbox[c]];6 x& O D9 M! _# z& h3 o
no.text = arrtbox[c];
1 v- o1 P2 V0 Z7 r( otbox[c] = no;
. _' K; b, n9 p' ^" B }0 X# ~5 W& p. q- I; ]
}- B' [3 T/ f- _5 s# R
</script>
- w3 P" V! U2 R( U# g</body>4 l, o, ]- x( ^1 Z. x
|
|