  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14197
- 金币
- 2389
- 威望
- 1647
- 贡献
- 1337
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"' U/ i3 F9 k- \* ?: G) h
c pageencoding="gb2312"
0 ]2 E6 W! c/ Y/ K%>) j' g! b2 o. f% k( U8 V; b
<style>; B9 V% ^7 z- G. o1 G
.f9{ font-size:9pt; }! z! r p; G( T
.bgc{ background-color:#aecaf9; color: #0033ff }
9 H' L$ U' e7 q3 J {0 Z- `3 b4 h.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
+ f- Z8 h/ w9 _; h# |: ^5 G% X border-bottom: solid 1px #4e7dc1;
' x# v& R" b- D. u; S- l" I border-left: solid 1px #aecaf9;% T% D; t! N& g0 f
border-right: solid 1px #5679bd;
# h8 O1 M, W! Z+ _- O- h3 [ padding:1px;5 U+ V1 z4 _6 R2 \" V) m
margin:0px;}& a! j# H% h7 m
</style>
& w! O$ L( \9 v<script language="javascript">
3 t) N; y! `4 u& ]0 x<!--$ Q) i% y1 f. @/ ~" }- U; e/ e$ w0 S
function rv()
m* ?* r' q- A2 g) h{5 ?. n! C8 _1 n: u3 d
var val="";' p/ F) S9 z$ m: X; F
for(i=0;i<combo_box.list2.length;i++){
: D) G2 y/ ], [) D- q* h val+=","+combo_box.list2.value;
2 z q* @0 W4 T2 _' S7 u5 a }; j0 K$ R0 o! {' X# k+ f
if(val.charat(0)==","){$ u3 A+ p6 a* m: m
val=val.substr(1,val.length);$ Y% T$ x5 o* c+ @/ e z- }
}; B$ S) r( P. O. G/ f, _. \) o
opener.form1.frecname.value=val;
) D9 Z0 J \: |6 B m$ K( m self.close();
3 J: _" B; I( h. ^. p# x}
2 w" R3 `! ^6 u1 I a# C$ t; R( n$ u- [//-->, H# p% J' B0 x. D- U' V* b
</script>
; k: b; m! Z5 p* N* A<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
; r' X) N- `, z& R2 s. w0 {6 v; K<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
; |$ U, |/ N+ [<%- G" A0 F2 n; P; [
cdatasource ds=new cdatasource(); //数据联结bean实例
+ B6 |& a1 h' p& h/ M java.sql.connection conn=ds.getconnection();
! J- ^6 ?8 m* J. S- h! V1 t6 d java.sql.statement stmt=null;9 s4 t* }. g1 [' {8 t2 s
java.sql.resultset rs=null;
/ d) g, U2 j1 ]% [ cdatacheck dc=new cdatacheck();5 P1 K/ s- A* |' u+ x5 J3 D M# z& N
%>
; G$ A+ {! a* Y, X) \1 i" {<%
! y3 ^% @4 `' ^7 i& wstring 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";% q+ x% I6 d% v5 z& @2 s
stmt=conn.createstatement();1 Y1 a8 p% H; ~9 n
rs=stmt.executequery(sqlu);% J' ^1 d7 K/ I7 e8 H8 _( T
%>: p( a1 S& V3 k+ H
<script language='javascript'>
% s) o* ^3 ]6 I) Z$ p1 larr = new array();
) e5 B6 @$ n& o) x<% int temp=0;( i4 b0 E. `- D/ F
while(rs.next())' n8 a, z# }! U/ T9 b
{
8 W4 D% x `1 P0 K0 f( K; n%>: Z/ l4 ^# }: k& I' v+ B
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");3 s4 W; w% a O% B; t! W4 E
<%
5 p. z6 ] W+ z Ytemp = temp + 1;; j7 _% N' X: e1 l$ O7 O; ^
}2 p) }- Y/ _4 X; D
%>
% u; w* p. {8 h C d6 y7 R- itemp=<%=temp%>;& j S8 o2 d/ P) P
function changelocation(id){
/ q8 ^, {% U: D9 j5 Z$ Mdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 4 ~0 W4 S) n0 l$ k" [. q
var i = 0; ! S" _6 ]% _2 U% V
document.combo_box.city.options[0]=new option('-------','');
% x% ]. F$ A7 k7 \for(i=0;i<temp;i++){
% L; x0 y' c; \if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] V- A6 Z$ z% Z
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
/ {3 Z) b6 _2 p `, z+ v} 4 c1 D/ h4 j9 u3 P9 U2 B' _3 b
} # d) n% Q( E) ^; W' _
} & K; F4 H; m3 ?4 C! z
</script>$ ^0 w8 w8 @' Z. V2 S. E( U
C1 s2 R. D6 ?$ Z
<form name="combo_box">
: d0 o) I" W& c d1 X* D<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
5 P- u$ Q6 a7 D, Y1 K, a, a <tr height="24">- I V) T: @9 T/ ^: a2 x# z/ C
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
% y/ |: l5 i) ~. e <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>0 r/ s2 e6 }& O4 E: N K" A: Q
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>* H+ I6 y6 u# b
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>- F4 ]' h( j8 }3 j! w
</tr>
% s( U1 }+ S6 h- |+ z+ F/ R' g <tr> - |# U- i1 I( M$ E) t
<td>
# M* J) g4 P9 Y" }) d <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
4 H& ~0 m7 E8 G0 K <option value="0">请选择部门 ---></option>
" L4 b7 _' _9 j<%' N+ E& H H; N x: ~4 I7 P' `
string sqld="select * from tdept";
4 l& Q: S( ?6 v* W6 Tstmt=conn.createstatement();
6 p3 _9 S+ }; |# ?rs=stmt.executequery(sqld); k5 a0 H# R4 k/ ^' o+ n) w/ F1 P3 W# ^
while(rs.next())
* y7 W. Y `8 }9 n( s9 S{
" U' F, p% W2 Q; p%>0 s- _# Y% S/ v! x' t
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>1 R4 T- d: P" V
<%
G6 q9 d7 l& M( M# E5 p/ T ^7 b}% p" J0 p* w, ]; g) H
%>
h# Q. Z7 B. ~7 B </select>* u1 B, z4 j) K7 m* I6 S
</td>
$ n# C* i6 I5 a* ^$ @ <td>
% C# n% X, q# ]6 r% x2 |/ c <select multiple id=city style="width:150;height:200" class="bgc">
3 N2 u) W1 F1 A: }, f5 o+ m </select>
/ E; E/ m" W' i</td>
8 G) V3 U8 \! a: f9 X4 [ <td nowrap align="center" class="bgc">. V/ h+ W# u- \9 u
<input type="button" value="<<" class="buttons">
4 s/ g' R, w8 Y$ R) w9 g h# [ R" t4 K <input type="button" value=">>" class="buttons">
( l9 {+ A' d7 q- a</td>
- y! ^0 D6 B( Y3 u) g <td>
9 G" o$ K% D9 H( h r <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">% d/ r/ b7 H# m/ B
</select>7 m0 x* B/ G. Q# A2 W3 y: o
</td>& g1 D: s# N% a) V
</tr> q% M4 T1 M9 V& q" b
<tr class="bgc"> , r. n! \; o6 S
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>: M" E4 _# I. ?
</tr>9 P3 |7 r, w" y+ [- |; ^
</table>
6 @# ?# j. R5 x6 \ @7 o</form>0 d! s& J# @3 U8 \1 d
<script language="javascript">1 U9 p* R6 W5 [2 ^
//人名移动
8 O6 d0 x& f2 Z( ^function move(fbox, tbox) { R: L x8 k3 G9 ?* X. r
var arrfbox = new array();) A( W! T4 A( F" R* p
var arrtbox = new array();: n; J8 ^4 d0 W# u1 `! Y
var arrlookup = new array();& T; P& L: E8 C
var i;
* ~# m. @! Y$ ^0 i+ Dfor (i = 0; i < tbox.options.length; i++) {
" a' W5 _0 n3 p, k4 K. Carrlookup[tbox.options.text] = tbox.options.value;
( |# c6 u- z3 v5 T( Harrtbox = tbox.options.text;# ^ [. Z6 Q6 v' ]( [4 }
}
6 P+ F: u/ o2 m# ~var flength = 0;
" l g( @ ^& P! ovar tlength = arrtbox.length;% s+ Y, M1 D- X$ P5 F+ x) Q
for(i = 0; i < fbox.options.length; i++) {
% Y0 C2 I1 m+ j8 Z; D% garrlookup[fbox.options.text] = fbox.options.value;
$ o1 q8 P+ ]7 ?& r, iif (fbox.options.selected && fbox.options.value != "") {5 ^' W6 a' F! Y% g3 s
arrtbox[tlength] = fbox.options.text;
# O6 m7 P+ U2 |9 Ptlength++;
2 r k$ O5 }$ N" q* N}& v: H* ], N" _4 Z1 ~) E+ L
else {
3 ^) m5 f E- v" o; l% Q: |arrfbox[flength] = fbox.options.text;& I) c/ ?! {' `
flength++;
+ i/ T! N% ~; _) A! Z" }$ j } { p6 K6 h |0 K9 \5 g
}
# y2 J: q8 k& d, ~. K+ Jarrfbox.sort();$ \$ E _+ [ Q |! q2 S
arrtbox.sort();/ T) U% U, r# D3 J2 [% T) H
8 q: W0 x5 g) g8 E! qfbox.length = 0;
# q5 J" C6 N- Z4 @. M6 |tbox.length = 0;5 P2 \, s5 R3 v
var c;0 D$ @$ Y, _5 x/ w6 b8 v! i
for(c = 0; c < arrfbox.length; c++) {
F# B; O) f4 L4 ~2 R9 tvar no = new option();/ _1 T6 d0 w3 z( p
no.value = arrlookup[arrfbox[c]];& B4 j7 n0 Z9 Z( I1 T* ?' |
no.text = arrfbox[c];; p; \9 \6 b* t# ~
fbox[c] = no;
n2 G! o8 R( R1 o7 q- [9 {1 ~2 F}
4 N1 `5 R e. @- l" G* s8 ?+ Ffor(c = 0; c < arrtbox.length; c++) {$ N+ W& R- z; ^8 ^
var no = new option();7 f# h$ P- }# P1 N
no.value = arrlookup[arrtbox[c]];
! u) A, ?$ B. r% ono.text = arrtbox[c];3 F# h ~( G6 P0 q3 K3 y$ m
tbox[c] = no;6 u+ H2 _- B0 p/ x( n
}6 T0 s/ W a: h: m6 \; |/ x& F. r
}0 v' p; q3 _% s% P) c+ l
</script>
) H: {$ Q0 J2 H' d" |2 J</body>
5 ?/ Q r! n7 O) ?( j& \& T |
|