|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14385
- 金币
- 2478
- 威望
- 1647
- 贡献
- 1426
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
; Z; P% l0 C! V, v! O. C c pageencoding="gb2312": o* K# C5 ^& y6 y+ P4 y4 l
%>4 V9 d2 m$ z1 _: X' B' q
<style>' V t' D; K/ A% s) J
.f9{ font-size:9pt; }. e- |) s* T) F5 K) U' ]! z
.bgc{ background-color:#aecaf9; color: #0033ff }/ N5 V5 y4 h5 R, s: ]5 k% f6 E" a
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;4 K; ^" l" T- U9 ^3 ?! S# Q
border-bottom: solid 1px #4e7dc1;
, r2 s3 |; a# V: y border-left: solid 1px #aecaf9;
- r4 O' S6 C O border-right: solid 1px #5679bd;2 j! }0 z( a- b' G" T" T# v- n
padding:1px;2 A& \2 M6 M8 d, i7 B5 |9 H
margin:0px;}" r- g! |6 {( r2 a5 l' C
</style>
! c0 P3 ?4 N- ]9 p( {* u8 {0 q6 g<script language="javascript">
( ^1 y; X3 [0 R<!--
6 N* L) U9 O( a4 U2 T# _/ T! |function rv()
0 ^' i$ c9 Q4 P5 O# x/ M! |; C{
; z7 n4 }; O9 w. B var val="";' M& u/ P5 i4 S, W! C6 R
for(i=0;i<combo_box.list2.length;i++){' ~ N! v: ^" g( G6 C: V
val+=","+combo_box.list2.value;
& i3 Y) u3 D, b& x I, T3 J }4 Q7 X z2 n# F* m
if(val.charat(0)==","){
" C/ B6 V" O) n) T- x) k1 i val=val.substr(1,val.length);! D. { s" n4 [% \3 s4 X; ^6 I/ W5 q
}9 L# {' ~4 L' S4 q' i" L2 ^0 ]
opener.form1.frecname.value=val;
; T* f* ^9 ^9 m, I3 } self.close();
' n6 q+ O O5 m}1 m* R" f4 |2 v2 m, N
//-->
- s2 U/ _; ]$ H( u4 X( e</script># a$ \3 `7 O4 k- _+ Z
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">8 ^/ P7 c8 B+ m3 N, N
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />% d& K! y. t& i' J2 N
<%
1 O1 r9 A. i0 f, ^& y! @ cdatasource ds=new cdatasource(); //数据联结bean实例
: P. T4 G5 ]% d4 _9 L6 J1 [+ n java.sql.connection conn=ds.getconnection();
! B1 N- S7 R- e6 d2 c* _' n* I java.sql.statement stmt=null;
) c/ Z& s4 R( V/ q8 W: } java.sql.resultset rs=null;$ J: r& i8 y8 `( V! C
cdatacheck dc=new cdatacheck();! N1 y, s, D0 y4 v. O3 X
%>5 l* p7 M* Y0 p& B5 Z/ c9 N
<%- R' @5 E& M/ Y/ A# _! R" L
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";
. z8 T+ L3 D" g' B1 Nstmt=conn.createstatement();
$ U! G9 L( l# D8 `8 d5 urs=stmt.executequery(sqlu);
/ M# P( W3 w$ t8 {%>
2 t# B! k0 G3 `6 q<script language='javascript'>
% Q, n; Y% ^2 s1 t; Aarr = new array();
# q! d6 U- @7 D; e0 i: [. |- R% ]<% int temp=0;
% G' `3 g+ M$ {' L( N5 w5 `" swhile(rs.next()); _5 ?1 F/ q' U' _) @' `
{
, u* b- h' w; Y8 y& ? p( I- Z8 ]%>! E; d/ _1 Z, U9 U9 u
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");! ^6 N; M( Y- j, j( j m; B
<%* F+ i- n' V& w2 Q" {
temp = temp + 1;" F) B6 w( C4 h1 T$ f9 a1 |
}
$ O' B z7 l: T1 g: j4 y8 r%>, y( k4 D$ m* f
temp=<%=temp%>;
" s8 e4 y/ ]: cfunction changelocation(id){ - z5 |9 _4 G3 o0 i" a: D
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 & ]9 |; [$ G- c
var i = 0; ! W m+ f* i/ T: b
document.combo_box.city.options[0]=new option('-------','');
' n0 V+ b5 U4 x k. r8 Wfor(i=0;i<temp;i++){
7 O% Z& I$ k. j& i- S+ t* D2 |if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
5 ^& E) D$ q7 K9 A8 A( c& X, ?document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
* ~% m( g9 S, g8 w$ b3 |4 X0 y}
4 M; N5 ^2 i& Q2 L4 ~7 j}
7 b$ G0 L2 D' H. k* C}
/ X1 Y+ X3 t) v7 T" m1 a' F. M</script>/ U; n2 S, \* m8 h
6 n) E8 @3 K- `7 G) ]; E7 f
<form name="combo_box">
+ t* c9 e) U5 B" p# }5 K# i<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">+ h: _; u2 [3 m/ w8 C2 Y
<tr height="24">
" p( q# c; s' {& J <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
1 s# r! `+ y: c5 K; \7 _6 [ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
& q3 ^6 B7 u: ]$ l/ E1 _. ? <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>; u. D' D: g) H) m! ~
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
$ X% `# `# Z# T6 G' u( ?1 e* ` </tr>
. h; e) E8 V W! Z <tr> 4 t- I. M+ q" O8 B& d
<td>2 o* J4 C! D7 T
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
+ R7 F# u7 q# A <option value="0">请选择部门 ---></option>) j) i( y4 F9 u
<%! f5 j1 a0 ]4 F
string sqld="select * from tdept";
8 g* ?& Z* | L6 vstmt=conn.createstatement();
U" U9 F( W; J. }" m3 G) yrs=stmt.executequery(sqld);, N( s4 G. y" e
while(rs.next())
: A% G6 {% w X3 V5 R{
0 y+ r7 _3 N5 y$ m6 I%>) U$ O/ S: K: u+ R* H {
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
# o5 x2 v5 S2 n! B: E1 u) f<%* p* s/ W& i' u6 n6 a% e# |
}
' [' ]5 P8 {' e* [' D" m: ?0 g2 X3 F%> + }2 e! n8 [5 {0 M4 Q" C. e) e
</select>
2 X/ q1 }+ l6 O4 N. o</td>
! H6 m% |5 @, T+ _ <td>
: m$ Q4 R# p0 D8 [ <select multiple id=city style="width:150;height:200" class="bgc">5 S* R9 `8 u$ D! c- ^4 x$ `
</select>
" ^3 G% Q+ `3 T: E$ q! V</td>
" E6 l1 _5 t* H* }5 j) G, v8 e E5 e7 k <td nowrap align="center" class="bgc">
! C8 ~0 {/ h, X, ~8 H( p1 b <input type="button" value="<<" class="buttons">
' u) Z# q9 T& l2 H- C2 \ <input type="button" value=">>" class="buttons"> _" m2 A |5 c7 L' N' g
</td>( o9 k! u/ {$ N) W1 B1 {
<td>0 V# V; A1 G- W% p; Q
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
8 ?; _1 u. f! T2 n% F </select>0 ^3 v6 S k' {# P: z
</td>& r) A7 h, Q/ a+ K q9 d
</tr>
o: I& ^4 {" x, E, w( V <tr class="bgc"> ( Q4 z. V5 _# T1 }* x4 k m
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
% i. F6 f" q/ N </tr>
. B1 H. D" C* c+ t0 V6 o</table>0 Z, ] u6 L- k7 n v; T5 w4 X
</form>
% W; |+ J/ L0 Q+ l<script language="javascript">& M# W% _: W, s: u* O" Y
//人名移动4 Y* r( g1 i9 J; N# R
function move(fbox, tbox) {
8 k( B1 o4 j& [var arrfbox = new array();
0 m2 Z# ^1 J& g3 r8 d, P8 ^# X) J1 o7 vvar arrtbox = new array();
# Z" c* s. y% m: h8 y+ H5 cvar arrlookup = new array();
& M: g" g/ L( _3 F6 Cvar i;
6 m: h2 i7 j5 x. y+ ?- t3 lfor (i = 0; i < tbox.options.length; i++) {
- m2 y( e# p7 K" |2 zarrlookup[tbox.options.text] = tbox.options.value;
$ C2 |8 b, _, d* K- u' a% yarrtbox = tbox.options.text;% E; B! d- s, t" |$ j$ }) ` b/ ?8 p
}- Y) U! ]& _: ^
var flength = 0;
7 [" K5 y! X4 tvar tlength = arrtbox.length;8 j' K& |+ p7 N: H# r! z
for(i = 0; i < fbox.options.length; i++) {
. h# c1 p5 F5 W+ K' _arrlookup[fbox.options.text] = fbox.options.value;
0 X) q7 ]: h/ A9 Y$ a) oif (fbox.options.selected && fbox.options.value != "") {, h) }% ~; {, _
arrtbox[tlength] = fbox.options.text;: y, i& w; f( h! A- ? U) }
tlength++;
1 B& S' w3 |$ L" `, c2 d4 G}
1 \: R1 V$ t5 velse {# P3 E5 C$ X( j* p& i! j5 E4 ?
arrfbox[flength] = fbox.options.text;
9 h5 T5 C2 ~' I+ Q8 {flength++;
# S* ] W. U/ q1 E- N, s2 p }
_9 S) C! N; ]# ?}
9 r& t, J+ F7 u: G- f1 k: C9 iarrfbox.sort();- M b: h: O* Z+ z9 e2 B
arrtbox.sort();3 R! i* Z+ u3 M- ~& r' v' U
$ i: V% ]0 J tfbox.length = 0;
5 w j& T6 F f' htbox.length = 0;. D2 G6 y" [9 K$ ?4 j0 k& n
var c;
# o7 B# z1 k0 P6 A# a' Ufor(c = 0; c < arrfbox.length; c++) {2 `6 W/ k/ R7 m- j7 L
var no = new option();
* F( O4 v4 p* ino.value = arrlookup[arrfbox[c]];
$ b4 F/ j2 V; B( l+ D rno.text = arrfbox[c];
2 z" Y9 Z: h# N( t7 U) qfbox[c] = no;
% U8 Q F! H% M4 @; s}: m+ Z$ H# F9 S. `
for(c = 0; c < arrtbox.length; c++) {
9 ]% Z* B2 h+ }$ Evar no = new option();
" [+ e! R# r8 |5 \8 {, cno.value = arrlookup[arrtbox[c]];1 y. m b1 w9 _2 w! r' M" j
no.text = arrtbox[c];( {6 K2 L( P2 F2 B
tbox[c] = no;' ?& p& f2 y1 y. E2 c! T& _
}
+ u4 }. y. x# [+ J: G) {}
0 h+ L+ a) J8 d) v% k4 _</script>
: `' p9 m) h% m# V</body>
$ P5 J! w8 u) f& @- O* u5 a8 l |
|