  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14249
- 金币
- 2415
- 威望
- 1647
- 贡献
- 1363
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"# U+ a: G8 m# I6 i
c pageencoding="gb2312"& `2 g2 ]$ H- ^
%>
7 j0 \2 O$ t( G<style># X& M1 x; _+ G; t2 Q
.f9{ font-size:9pt; }
; X% `0 f2 O& x2 U- j3 p.bgc{ background-color:#aecaf9; color: #0033ff }& v" O$ ^) ^* D% \ W, p& p/ n
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;/ |2 J- ^2 T+ p: M; y4 I( W3 U$ R
border-bottom: solid 1px #4e7dc1;3 p" D8 p2 ]7 z+ p0 e# H; x
border-left: solid 1px #aecaf9;
1 e( i' r b! T' _8 F, J2 n border-right: solid 1px #5679bd;
1 v" g) h( [% z t' b$ e padding:1px;' S9 Q5 x3 d6 J) m
margin:0px;}- } u3 w0 ~' P! `
</style> d6 K' S' W1 @( O5 x& U
<script language="javascript">
* a6 ]) {# x* a O<!--
) L+ x. V( b+ ?% V0 t6 Q [$ c% Mfunction rv()( e( R I0 O* @; U/ Y7 u* o) l3 H
{" s% l1 c+ X8 R- F4 P+ _
var val="";
, w* Q9 ?$ z* f1 y for(i=0;i<combo_box.list2.length;i++){
& D0 f! x% U1 ^- B, f: m val+=","+combo_box.list2.value;
1 O* F8 Y+ S1 o- f. k' } } }
+ Q, |7 ^! D- j" D8 ` if(val.charat(0)==","){
5 R1 G" U; Q3 c8 K val=val.substr(1,val.length);- U0 c' j3 K- [: ~! e. e
}0 T; s) t9 k& p/ I4 E
opener.form1.frecname.value=val;
% s8 U% W3 g" f E' p5 ]) C self.close(); Z8 C3 C0 H/ C! b
}
" C6 T3 s7 A# ^- F& L* D. D//--># [/ J$ Z& J3 M- F+ Q- O5 f
</script>
3 r# w2 I$ |0 k9 ~<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
( I& ` c' }2 B+ m" r% p2 e. i<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
* O* r/ f6 w: Z<%" a4 j" _+ ?4 F1 Q( w! a
cdatasource ds=new cdatasource(); //数据联结bean实例, _7 S# e0 V* G" V# z7 j3 @) H
java.sql.connection conn=ds.getconnection();
9 y3 X3 r) S- [ java.sql.statement stmt=null;1 s6 Q* ?% X5 j6 h( c( {
java.sql.resultset rs=null;; E$ S4 g% J/ Q+ i+ P' j
cdatacheck dc=new cdatacheck();
3 F" G) J; R) y/ L/ C%>
5 |% a" ^. \* I<%' f4 \% C7 ?4 e! N: c# y. B/ n" Y
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";
& n* F8 k+ E3 F: m; {/ S5 ~7 z7 zstmt=conn.createstatement();3 T* @* D/ _% [5 A w5 K7 U) {% b& p
rs=stmt.executequery(sqlu);9 R6 R4 t9 N, L9 d. |
%>
. _2 Q+ B3 x3 N9 H" E: ]<script language='javascript'>
6 ]. V+ `% {) E( h5 k1 G8 qarr = new array();
2 O0 \6 s2 {. V0 E<% int temp=0;
& I& s j' Y9 L1 X( zwhile(rs.next())
3 p% V5 A7 T. b% _{
4 G( c) k/ u6 Z# u%>
9 {; H8 w1 \' g( F7 z; barr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
+ R& j" K7 w' G<%
, z& O! Y% K% G/ q# Btemp = temp + 1;1 V; w b T( I8 D$ ]* g3 G! b
}" i- D9 c: Y8 d! P U
%>
5 s% [4 n( @/ |temp=<%=temp%>;
( Z( X- l2 p- [' i( S$ R xfunction changelocation(id){
0 }3 A, h( M/ tdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
) S+ N. t* d) z8 Mvar i = 0;
4 _9 w0 S* b6 g- A& o4 k8 ldocument.combo_box.city.options[0]=new option('-------','');
* Z1 a6 l2 _2 p3 \5 ]( [5 d( }for(i=0;i<temp;i++){
/ L y3 {6 w3 d" e6 r7 lif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
) B! ~# h& y! T( rdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); ! o$ f9 i6 l R; Z
}
" a5 k8 J2 Z. |* i" y3 o9 L0 P0 n}
/ J6 V* k5 F& D# f! l} & M$ E9 j& k1 r9 L2 C* {8 x
</script>8 P& p2 h$ ?# ^& \# i; z+ M
) a( n x1 O$ j' B+ ~<form name="combo_box">- _1 x/ J: `4 t+ G- N
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
* o7 c% z' g: ?5 V x% }/ c$ @4 C <tr height="24">( V' C l& [4 f* ]: \; |. j
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
4 v3 _) z& _' }6 v* m) D <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>! n( h: E- C# }3 r
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>9 h) c' a, X. O2 O
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>- ?& l2 ?" N5 A
</tr>$ t( U8 ^/ u5 H5 ^. L+ b- V
<tr>
. i# C- H: ~6 V: w4 L2 @9 v <td>
1 P! A1 g$ R' F; ^ <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">: X8 b: L, d. A7 @% |, B! j; p
<option value="0">请选择部门 ---></option>
, O7 v2 l- @3 G3 K<%% c8 u1 m/ v$ \) B, U5 e& _
string sqld="select * from tdept";
5 \( ]8 ^9 {, }( |1 Z% Qstmt=conn.createstatement();5 a7 K2 ]4 B6 R- B( m) j0 D
rs=stmt.executequery(sqld);4 v1 `: |, `; ^. `- X
while(rs.next())
# ?9 N* v( q/ T- U2 k, _* z/ T{7 q @4 k- D5 r! c0 P
%>
$ J1 a. D$ {8 @1 Z3 s6 L& a* r/ Q <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
7 b0 f( l- @6 K& u& H b' E8 i9 i6 I<%1 e* G0 J6 e/ _! }, s' l
}- V4 r& i! a3 Z0 h
%>
' H. R4 Q1 E$ n) ^: W$ o9 @/ Y; F9 { </select> [# z6 E( f0 U" m/ c3 N2 @9 G
</td>9 b/ V; M& E- e5 o9 N' b
<td>
- d6 w7 W$ X' c# F% `, d$ J <select multiple id=city style="width:150;height:200" class="bgc">" M6 b+ D: P( n" z
</select>+ I3 e7 A# ?8 U
</td>' U# }8 I, B+ X( l* s9 B
<td nowrap align="center" class="bgc">
1 p# b+ [+ d: Q, P <input type="button" value="<<" class="buttons">" k; p x0 b/ ]+ c! ?( ]4 [
<input type="button" value=">>" class="buttons">
* u4 K: @( l+ J) _3 ?* b! ]</td>' {- M! b. m. h) @5 Y1 K1 z5 c
<td>
! l* u7 `7 K0 W' [; G7 l: W <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
; k& n( A# H" d* Z; a% r5 ^9 y: [7 N </select>
, u" P9 M; w( X' _</td>4 e2 }7 i ]% W1 {/ Z
</tr>) W# R0 I+ O _/ i- i- J3 J( Q" R+ }
<tr class="bgc">
" H/ r6 i) W4 g <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>- x6 W: x, ^ ~- e; G( L* B
</tr>
. j9 w: N% d8 k; e- H</table>
* q# y6 d9 D. |: s1 D% C</form>: w0 x& Q% p# j* y
<script language="javascript">9 J0 G7 b; G' [8 H& B
//人名移动
4 }, n( ~. P* D) h9 w/ Afunction move(fbox, tbox) {0 o; d5 J$ z- L$ ]+ h, S3 y9 n/ b
var arrfbox = new array();
, J# B( B0 Q7 x- U! cvar arrtbox = new array();0 {6 Q- q4 n4 `- V8 G
var arrlookup = new array();
& v$ E3 ]6 \* c" ~9 h* \1 yvar i;. w" M# A9 F( ^+ T- p( y
for (i = 0; i < tbox.options.length; i++) {" m- A) E) o/ C7 o* I$ U
arrlookup[tbox.options.text] = tbox.options.value;
1 U! x* V5 x2 _! tarrtbox = tbox.options.text;0 `8 b( a L1 S0 M: i
}
" h9 p; J8 o3 nvar flength = 0;
2 l8 Q2 s4 f8 y1 N7 I6 tvar tlength = arrtbox.length;
2 E3 r- ]- O: g5 {for(i = 0; i < fbox.options.length; i++) {
( \. {* ^# r6 h. c3 r; D0 [+ Narrlookup[fbox.options.text] = fbox.options.value;: Z6 B2 f+ P9 w! s
if (fbox.options.selected && fbox.options.value != "") {3 j' }5 K" I6 v& `# e' y, W
arrtbox[tlength] = fbox.options.text;
; t+ r. r Y. J( j! ttlength++;& g# _6 X: |. v! m2 Z- N0 `
}8 G2 L6 C, L0 A# x2 @
else {
5 l4 l. v; k, warrfbox[flength] = fbox.options.text;) H1 g0 D/ ^8 Z" P; T3 |
flength++;
1 o v, P! s6 d$ ~ }
6 \& w: v* x/ F) B, I+ E}
9 V* P+ R' g0 b* I/ e- {arrfbox.sort();7 W, V! a6 Y$ B3 v: x9 r2 w) X( |* M( n
arrtbox.sort();! R* O0 j3 @* O8 _' O) b o @3 p: m
/ j, {% t- I9 J* T" \: E
fbox.length = 0;/ H( h3 d2 {- }
tbox.length = 0;& X4 H8 b* G% r2 l ~; \8 d! t
var c;: O. h- n* z- g2 r8 h; p8 e
for(c = 0; c < arrfbox.length; c++) {4 s5 F4 q2 w m. i4 h$ ^$ F
var no = new option();5 R8 P3 [9 _9 E* u9 a$ M
no.value = arrlookup[arrfbox[c]];8 Q4 s4 ]$ ^! i1 W6 w5 o( P& f9 z/ ]
no.text = arrfbox[c];) G9 A0 Y9 g% g1 i% @; I
fbox[c] = no;1 s2 J: b9 ^, N( @% l6 w. u; t4 [
}4 [# N* ], g7 \& `5 |
for(c = 0; c < arrtbox.length; c++) {* c. Z O7 W, E; G' w, v
var no = new option();9 W# p+ z* h+ d$ D) |$ T
no.value = arrlookup[arrtbox[c]];0 R; g1 Q( p0 l' C! z: y
no.text = arrtbox[c];
% l& o- J( x0 j _, @' q+ gtbox[c] = no;$ h) d& Z$ R. d. }/ {; T
}
2 V, t9 R! ^- c% U! C}: ~/ f7 [0 w- ]8 `6 u1 N: m9 ]5 K; r
</script>
9 P( r% f! _* w; f) P( e, ]8 i1 O5 H$ s</body>
; r$ w+ s. z2 s' N3 X2 r# D |
|