|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14397
- 金币
- 2484
- 威望
- 1647
- 贡献
- 1432
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
! Z/ b3 ~7 U5 j) v2 B c pageencoding="gb2312"# I4 [, T* E8 W }# e0 N
%># U) Q' M9 A- O; e3 b
<style>! ]) t8 U J6 z& G7 Y. g/ i
.f9{ font-size:9pt; }3 t. f4 m! j- \: c
.bgc{ background-color:#aecaf9; color: #0033ff }
) |3 {( S9 D: z" G3 X! h3 B ^ k.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
! O+ u1 N' S/ L" t7 V border-bottom: solid 1px #4e7dc1;
3 [" Q* i: L& K+ ]$ i/ G border-left: solid 1px #aecaf9;9 s3 p$ v6 x2 H W0 L r0 H' M
border-right: solid 1px #5679bd;* R0 Y8 B' N5 U/ R3 a0 x; l/ m
padding:1px;
; q9 O9 G9 Q4 d9 b" Y d2 f" _ margin:0px;}- x* O4 v8 O! g; F& t. z) {2 d7 Z: c
</style>
( `# ^5 O; t, d<script language="javascript">1 r C: X2 _2 x% s: b3 I4 C
<!--5 o6 q) _& i p8 Q
function rv()
: J( f% Q1 J3 x) S" W$ J{
& u- E! j2 r/ G) `0 h9 J$ ` var val="";5 U4 v* t7 L. L( j0 V
for(i=0;i<combo_box.list2.length;i++){
2 n4 ]# P7 W) R0 D9 @4 W val+=","+combo_box.list2.value;
8 @' C D( \# N" E/ ^$ c }- Y8 C* A- B) \ K* t8 w
if(val.charat(0)==","){
/ @1 I2 U. H; B+ d8 w3 t% L( P8 s val=val.substr(1,val.length);
) E$ V1 N3 d7 N& T2 S; P- j }
7 _; l. M0 K6 v opener.form1.frecname.value=val;& S; f9 G2 A* ^$ a' ]( {* w. o
self.close();. _& K5 W. s" D; a% a
}/ V1 L, B- g. H2 ?9 ?) w
//-->
( c' p7 r! N% I ?8 o</script>
9 c! P; \# r5 v2 h( r1 V, o<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
: G$ X* w# L# N% Y<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
3 P. V* f. x- I# w9 @* e! U4 j<%
1 X( B0 z( j' t. W) w2 A' @ cdatasource ds=new cdatasource(); //数据联结bean实例/ c" J1 t4 ~: L6 L' j& m
java.sql.connection conn=ds.getconnection();
' Q( Y4 u: W7 B7 ` java.sql.statement stmt=null;2 |1 R9 G% d7 n& r. m
java.sql.resultset rs=null;
# z! F* t( R; F cdatacheck dc=new cdatacheck();+ E* l* U4 \ n# \
%>( i* \; R- Z/ R' a6 _$ [9 `
<%' w- S4 _0 R, { h" N) l+ T
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";
: ?! x7 y2 X/ k; L3 z- d- S3 Rstmt=conn.createstatement();
! V+ g' t+ [7 Q( _( jrs=stmt.executequery(sqlu);
) i, F7 a( ]* Z%>& c! L8 p% R3 |& I, t; `9 Q% Y0 n5 l
<script language='javascript'>
8 q! W6 f; b3 y' E/ Aarr = new array();% D/ X( R4 C8 T: C
<% int temp=0;' I9 d/ w$ B. A- O
while(rs.next())% k+ p1 J* \5 G( ^* D1 ~
{
* y. {8 [3 e. ?' t" D%>
, ~( } \! A0 t. {( J1 Z( D- u* K, [arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");! m" C0 p2 G7 V+ J
<%
9 L0 Q; O E6 j8 s vtemp = temp + 1;
6 M' r# a" W) m6 B) T}
! s' G' r" k& `" M" m" k%>
- W5 n. N4 \5 I, d% ktemp=<%=temp%>;4 t# y% w/ S3 G- i2 _" V% n/ ?
function changelocation(id){ ) l* \3 D: ~9 J
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
8 L) B5 p( m7 p6 b( G; rvar i = 0;
% I5 Y$ e# Y8 W8 y2 N; m* }" ~document.combo_box.city.options[0]=new option('-------','');
% Q V: Q) W0 v4 Q/ Y' ]7 G+ X0 Yfor(i=0;i<temp;i++){
, X' Z) v: R( Z( t) D8 s% F4 fif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
" H& r. _" W+ ~1 Jdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); " m9 n$ I8 c* b& V
}
' Q: h" A! L6 d, t4 n: u8 E( T}
2 }; N, n$ e% Q$ X& K% [5 Q1 R}
3 N% y+ ?* A8 ?/ d7 I3 {</script>
5 \( H0 A: {" j$ d" L9 @! |& g. \2 p7 i
<form name="combo_box">
' O8 R0 ]) C; }0 m# y<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">$ Y: [& ?6 z, R- g7 i$ {, n9 {7 `
<tr height="24">3 u0 Y8 Z9 _5 a+ k
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
0 Z# F8 e$ U, _) K; m <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>2 w/ R* K) B. Q; t" ^9 | F/ Y
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>5 N9 B, S- L$ U! ?6 D+ O
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>+ l8 \8 p/ E& F9 Z
</tr>
, Z( D! v5 v# U1 v' w7 H <tr> 5 F) ] E6 N; g( m" t
<td>
: F7 o2 Q. A9 P# l4 s! ~: R <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">& j2 r' c3 g/ Y2 }3 O# x
<option value="0">请选择部门 ---></option>
9 V1 i, F/ E5 N! T<%, C6 C p$ a' d/ K2 @
string sqld="select * from tdept";
6 V6 p: C7 Y4 Pstmt=conn.createstatement();5 d* l# {+ v2 I" d o( g T
rs=stmt.executequery(sqld);
, _- f5 q1 V4 e* Wwhile(rs.next()) L s* s d5 |
{
* j; W0 P8 S$ C* L7 o# M%>
4 }! Q3 ^% }6 N' h: r4 f <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>: ~# h" ~' i9 I s" Y& V' n
<%# k4 m' `& j) l3 C% ~3 E# j
}
4 [* ^# C) k$ {# y, A%>
! L" Y9 D z5 P </select>
# h& v2 C. \' J, Z A</td>
! r& @8 }; V: k, v7 B% |! s: `3 ~ <td># B$ _' w! r# k6 b I
<select multiple id=city style="width:150;height:200" class="bgc">
4 k6 ^3 {1 b3 W/ `3 `8 A </select>
4 M( L: s; w4 \/ b9 t</td>
4 F5 {* Y/ z; y! ] C8 w: c <td nowrap align="center" class="bgc">( N7 z4 @" Q1 G9 b0 a
<input type="button" value="<<" class="buttons">
" u' n% M( a/ |& `5 e$ i2 l <input type="button" value=">>" class="buttons">0 o7 L/ E4 [) b) E
</td>* q$ f) ~3 z& D6 c
<td>
& S6 c7 D. P6 a! M" I) f0 D <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
* m6 O% Z8 u/ W/ Q </select>
' {: p/ L- x& Y$ Z</td>: ^4 Z4 m q+ T3 C0 h6 g$ X5 O7 d; X
</tr>
8 ^4 Z4 y0 {6 E+ _6 T <tr class="bgc">
: V1 K0 c2 v; S: y' F2 ~! H6 b; n <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>, Z0 }7 n$ d& b
</tr>3 `( c3 |( U' M% r
</table>7 m: ?7 j/ w& R
</form>5 L0 S6 {! z" W) g7 `
<script language="javascript">
) i; n. F* A4 D//人名移动7 o- o+ v" q% W1 y; w: W) ?: I
function move(fbox, tbox) {
3 [/ H6 S" D- ]4 F6 Uvar arrfbox = new array();* F Y2 c" V/ z
var arrtbox = new array();5 w3 W5 ?: [" |, L) |
var arrlookup = new array();
0 A& w9 I9 T* N, x4 cvar i;3 } `4 D1 [7 N
for (i = 0; i < tbox.options.length; i++) {! ]8 m" I" P. _+ x
arrlookup[tbox.options.text] = tbox.options.value;0 A4 X# G# A/ w0 C0 U* T2 N6 |0 i: I
arrtbox = tbox.options.text;" X! s, x7 d$ ^5 N+ M" ^# g) w* C
}
" z% E0 B+ H. I c1 Hvar flength = 0;
. ~- `% H8 k0 p" c5 T4 U% Uvar tlength = arrtbox.length;' G( L* m* P; O8 E8 C4 e# ]
for(i = 0; i < fbox.options.length; i++) {. x% S8 f1 i) Y5 s8 |5 H
arrlookup[fbox.options.text] = fbox.options.value;2 }8 {8 u( Q9 B
if (fbox.options.selected && fbox.options.value != "") {7 l3 p) T8 K; N: V3 W/ \2 k- X7 w' R9 h
arrtbox[tlength] = fbox.options.text;% _2 e0 |0 B$ |* c2 W
tlength++;
5 J" V1 x1 {; [! d" r; `}
s3 {, y5 a! y" celse {
; G* @& q/ y* k$ U. Varrfbox[flength] = fbox.options.text;! P7 m2 i8 y: @, s# ^4 t
flength++;
, Z% a3 Y! G5 e/ @3 l% b# V, `3 Y0 h }- [, ~' z- Y/ t! j% q8 |* B
}7 z' S: y0 o. I# L! U' w+ B
arrfbox.sort();% D& k0 i3 Q5 U. R2 y' E5 B
arrtbox.sort();2 h0 {8 L# J& F2 n1 O, U4 C4 Q# r
9 [+ k( |/ w/ q5 Zfbox.length = 0;9 p8 M" Q" l' ?2 |2 k
tbox.length = 0;
3 F+ O# n- ?/ ^, m( X7 Jvar c;7 Y/ y0 `4 l! G J
for(c = 0; c < arrfbox.length; c++) {/ p3 [% t1 C& y, e+ U+ ^" v
var no = new option();
$ |0 [9 r' Q# _" j z6 sno.value = arrlookup[arrfbox[c]];
" A5 ~4 L- c# c! I4 rno.text = arrfbox[c];
% e2 o% r& }. I1 ifbox[c] = no;- o" I" Z. N; O% X; c9 {0 C
}
/ k7 {2 f6 w0 u. g$ w" k) ?for(c = 0; c < arrtbox.length; c++) {
2 H! u6 X) O$ L2 _4 U }( d& {var no = new option();
" S( K2 R9 n2 L! p! ?& K' B! n% xno.value = arrlookup[arrtbox[c]];
1 }& D( X* {# i4 U0 qno.text = arrtbox[c];
0 s9 t. u! |& i1 D& v( M8 M. P1 `tbox[c] = no;
6 s/ t0 H& [& _- G7 m3 U/ M }& b6 M" q; |) b7 a1 x1 Y7 C
}
' v. P. Z4 r4 H. b l2 Y</script>& t! z W+ j& D: R
</body>
7 a* w* |) X+ L, s# H1 x C |
|