|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14387
- 金币
- 2479
- 威望
- 1647
- 贡献
- 1427
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
8 z& ?; u9 i+ L, g7 U3 D2 U c pageencoding="gb2312"
# K' n7 n: x8 D3 ^%>
7 x) E P$ v6 `* x" z<style>
7 @- X* Y. j3 E.f9{ font-size:9pt; }
8 {1 U9 q$ h7 ~, D.bgc{ background-color:#aecaf9; color: #0033ff }8 ~( V5 r5 S& c( |+ E* H7 k4 w
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;; a$ G: _7 L0 S/ P" V# o
border-bottom: solid 1px #4e7dc1;
1 b& N) a8 r8 F+ c! C3 V border-left: solid 1px #aecaf9;- w& O! D/ {! W/ l4 f0 r- p
border-right: solid 1px #5679bd;
2 W1 h- u$ G4 P$ i' {* ` padding:1px;
" F/ C& B! Y5 b* q1 _4 _ margin:0px;}
% V; x4 s V0 m1 J" V* i& j</style>
0 o7 W- V) S2 `: e# j8 ?. Z<script language="javascript">
9 u! {# x, v8 o m P8 G( P- b9 j<!--" c% p) d8 } }3 X" r
function rv()/ L( f! L9 h% _1 c# ]; W
{% r9 n: O e2 h1 m& l' j9 z
var val="";
( v6 d9 O6 ]2 }) n) M for(i=0;i<combo_box.list2.length;i++){1 G J# s0 x/ E
val+=","+combo_box.list2.value;# A; r+ U/ c2 f0 J
}
5 x6 I$ p& ^) K7 k" R' T# f if(val.charat(0)==","){2 X: Z0 h0 `& k, \8 Y! t
val=val.substr(1,val.length);9 Z9 N6 Q" B6 i$ f9 z! ?+ H9 d
}0 Q2 {# r" o' F
opener.form1.frecname.value=val;5 R$ p E" A' H. M9 j/ o+ y# h
self.close();
, p$ H7 L" k; F: e+ I: M' r' N}" `& `' z0 K- }9 d: Z( |. f
//-->
6 E9 j K" {9 i6 y/ z</script>
7 B9 ^: q0 a6 B- c2 f<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">- t' |2 o- W" u2 W% i
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
4 r. A0 M; J, y<%" V& Z) q! k( [' D! V9 @8 g7 t
cdatasource ds=new cdatasource(); //数据联结bean实例
# J2 L$ n" W% W; C; x6 t java.sql.connection conn=ds.getconnection();
" a) l! J- D2 r8 L java.sql.statement stmt=null;- {$ y* s) d% I% A m
java.sql.resultset rs=null;5 N) k6 P8 C! B' ]
cdatacheck dc=new cdatacheck();% A# d8 w8 U N/ V0 D# l
%>
7 l/ h* I- K7 T4 P<%% A8 T, ? ?/ k0 Q7 c# ?- W
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";9 W9 v _: R" @$ ?
stmt=conn.createstatement();2 q% p( Y7 L7 q3 h6 ]
rs=stmt.executequery(sqlu);6 r) D+ p8 i! `) u+ ?. s3 [
%>
6 e u" N0 j& n0 u<script language='javascript'>
, H4 L1 R: Q' E" p3 c2 u6 W( tarr = new array();- W( c2 d' g+ Z7 X: Q
<% int temp=0;; U6 k) ]( j) w* b
while(rs.next())
: |3 n Y% V( _{; i3 R4 y/ Z5 @1 D3 x# f: ^
%>, I. z; M6 `2 N% e! A" W/ I3 G3 {
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
& m2 Y+ G% R# C& o# E- B<% h+ }7 D, U! R5 J1 L9 i! `
temp = temp + 1;$ J% M* o3 g5 t' i0 m3 F' w8 z r
}
) I. U; ~2 M- a+ H1 v%>
( u& h: ]5 z% Z3 L& y" A" Jtemp=<%=temp%>;
+ j3 C( P0 L% ^! ~, ofunction changelocation(id){
' j. U+ i9 m' N) wdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
2 a1 r5 C7 w5 T" t3 Vvar i = 0;
+ u- U* O; \7 v v" Ndocument.combo_box.city.options[0]=new option('-------','');
' T' { _- [9 y! r* N4 ?- e* j# X% ?1 ffor(i=0;i<temp;i++){ $ k+ U/ v7 a! U& ?( ]
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] ! b9 n( M4 N+ L% b+ k' U. S0 b) H
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); 5 L) Q3 a" c0 o, s# R
}
; H( Y4 w( k6 z/ M* ]; O' o1 I}
. Y( `) Y% {0 B) g& a} , ~( v6 x+ j! `: @2 m; w* i0 V1 H+ R
</script>, o3 c( C4 P8 [/ J; C' T
6 \0 G, d8 H- x6 w% @4 Q9 X
<form name="combo_box">* i- A; m* g# [7 a# u' l
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
% N5 J# R) m! J2 `2 H+ ] <tr height="24">/ @7 F3 k+ Z9 q0 W7 d
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>' h' W! v& D; @2 b2 Z
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
9 Z9 I' X" r* i+ ^ <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
" V' _9 x9 F) K# b <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>* u$ e* ?( M5 Y, G# {; x$ ?
</tr>7 n. Z2 H, H- K! A, _
<tr>
* A! Y8 [' P5 N; h4 @' J J+ {; K <td>
' v V6 x# h* u: r <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">8 z' K4 A* P8 Q; I4 [: m
<option value="0">请选择部门 ---></option>) [) U% f9 w' T, W {
<%7 e5 }9 z1 a0 J) k
string sqld="select * from tdept";6 t+ B& H! \, m: k X9 G u y5 H
stmt=conn.createstatement();
2 `& K2 [! s6 z; h/ h+ F4 V& drs=stmt.executequery(sqld);& G8 w( r3 ?% f2 }
while(rs.next())# S$ n5 s7 E% j9 a4 _
{" r G" R& D8 Q& |: z4 Q9 u
%>
$ U7 L+ D! i' r8 M <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>: C4 z# c1 ^8 m! x) d# ]8 C
<%
' {0 Q P! |5 P) u1 u}
6 L8 A+ y) g F" V# q; J. S%> 7 K% X" z) C' x3 O1 q7 c
</select>
$ Q3 r3 W7 `2 ]6 T- @: v</td>
. }2 \! s# |) h2 t, |6 s <td>
& p ]2 L9 Z6 u <select multiple id=city style="width:150;height:200" class="bgc">
( D! ?' J, w+ h) J. t- N </select>0 F/ o$ n) `/ g) M0 l1 b% \5 {7 n
</td>
! N( t+ g$ {9 X D <td nowrap align="center" class="bgc">
6 M1 Z; E" v! F. M* s3 J <input type="button" value="<<" class="buttons">* G3 T. G$ u- |! q( K8 h; I, K
<input type="button" value=">>" class="buttons">
2 _& a1 W1 p+ e$ }/ W/ Y% \( c</td>% X% M0 G$ C3 ^
<td>' T0 u, v+ g& x' b% }4 H" a" v& N
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">5 w( {$ l" V' U$ Q; U, B
</select>
6 {0 ]9 @7 O) m: ^</td>
# x: N6 m5 d3 R7 f* o8 G5 o </tr>
. u& s1 N/ O( K' J% x# s <tr class="bgc">
8 q/ I" T0 A: B2 j6 | <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>8 O' e/ U% H1 I7 v# Z4 N
</tr>
. Z* J: k' z$ ]7 d# w</table>
; f3 D1 P! R' Q: s! @) V</form>
5 m1 I' L y6 t+ [0 K% i<script language="javascript">
7 n8 ]+ f0 `) h//人名移动
, h6 Q! B& v( ffunction move(fbox, tbox) {. ]0 P0 J7 V* A: q
var arrfbox = new array();
3 G- v) S8 Q, C6 j4 Lvar arrtbox = new array();
, h% [' G7 Q! M, d4 ^( Vvar arrlookup = new array();2 V, l- M: ?$ U5 ]$ i! ]4 u
var i;/ t% b s* G' W* {9 @. S+ l
for (i = 0; i < tbox.options.length; i++) {
' C9 J& x8 N Z; C$ rarrlookup[tbox.options.text] = tbox.options.value;: E0 X1 H2 m" Z% h0 B4 l
arrtbox = tbox.options.text;0 |: j. \) F( r H0 T) J' E" W8 m
}. b1 {- Z. a |% ^. T. ?* J# G
var flength = 0;
* Z9 O1 Z7 e1 Q" Avar tlength = arrtbox.length;
X& p$ ^, n$ vfor(i = 0; i < fbox.options.length; i++) {
5 B: S5 @: D! I3 F% e9 yarrlookup[fbox.options.text] = fbox.options.value;4 Q3 d; O8 u, B0 ]$ Z8 Z
if (fbox.options.selected && fbox.options.value != "") {
* d J7 B6 J# w: ^1 }/ ?8 [8 sarrtbox[tlength] = fbox.options.text;3 Y+ u+ {- ^' ], [# X2 S
tlength++;$ O) u i8 f4 A' ^9 D6 w! K
}1 @7 m5 g+ w5 [0 e. F& i' m" r
else {0 r G0 _7 D% Z8 B! u. U% D
arrfbox[flength] = fbox.options.text;; e. z" ^: `" k! t
flength++;5 W M% C: a' z* w$ S
}
- a4 I9 v- o3 }- p: o! G, j, C+ u3 ?}
8 ^7 c1 W7 C+ o) S% w2 j1 T- garrfbox.sort();
; \: Z1 e) [# q! W/ M7 ?) `arrtbox.sort();
) w& u# k, ?+ h! Z# F. L3 W1 B l) E* P% S+ b1 b" J
fbox.length = 0;
9 d+ y1 \; e. D6 e4 b4 ~tbox.length = 0;" q' N: e* [- Q& _5 J) z0 [6 K3 W
var c;' `5 E6 d" B0 Z# b$ m
for(c = 0; c < arrfbox.length; c++) { s G5 E& P9 y+ i
var no = new option();
. S0 _; o f7 X( ~" Z) m) V8 Yno.value = arrlookup[arrfbox[c]];4 |* U+ t/ h- L `( L A, v! Z
no.text = arrfbox[c];
- j w+ q/ x% J. o0 A$ Y2 B# sfbox[c] = no;" u7 K& j1 J" n0 Q$ {7 A
}
) c! ?9 K2 v: x9 Mfor(c = 0; c < arrtbox.length; c++) {8 S: `+ p! W, F% `# K
var no = new option();
( h, k' _. K. w2 Zno.value = arrlookup[arrtbox[c]];
( y# F; ~; a* T: D0 ano.text = arrtbox[c];
/ w7 q: }7 l5 j% l+ ttbox[c] = no;: r& s: o# G8 B
}% W% g: {: s, ~# P) x( j0 l
}
+ R- `1 y) u; s8 _+ M: z. {. R% Q</script>5 `- n3 k) @1 A& r9 X% _. }/ p
</body>: X( S9 I, E3 h( b- Z
|
|