  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14195
- 金币
- 2388
- 威望
- 1647
- 贡献
- 1336
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
8 u6 b. d# N8 [% D1 t; g c pageencoding="gb2312"$ s% q5 D- z' ]4 `0 t
%>
0 L/ d! K! y% R" P6 T/ y<style>
+ P: l8 l, E$ `) P; \* G.f9{ font-size:9pt; }
1 H( z4 i: d5 ~; n: o7 a.bgc{ background-color:#aecaf9; color: #0033ff }
2 o$ a& {* v( p i# @.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
& x6 _, k! k9 K+ Y' } border-bottom: solid 1px #4e7dc1;5 B( q) ~/ q. |; w( W! e
border-left: solid 1px #aecaf9;
9 y( K3 z5 V7 F% J- n border-right: solid 1px #5679bd;
: A. @4 h# b5 L* [- ^1 Y padding:1px;
- @( f6 p" K& \8 z7 z8 h margin:0px;}( ]5 m4 U! ?- B0 H$ p
</style>" g4 r3 @: i% o; N
<script language="javascript">8 {* P0 _8 j$ I$ _& N5 r- }
<!--& t& o J* k1 n6 \( i" o$ j
function rv()
& Q `- o+ R/ V' v- y' J' m4 Y{' V2 O3 {; ~0 A R! w' x
var val="";
+ A! E+ b) l9 Q' \! p; {7 F2 i( g for(i=0;i<combo_box.list2.length;i++){# N, }* S" T# Q
val+=","+combo_box.list2.value;' k% {/ o3 W9 v% y
}# X8 |( h) O L' h% q; o( u! o
if(val.charat(0)==","){) Q& X5 C$ F7 p& t. Q, {" R* A
val=val.substr(1,val.length);. {; m" K3 L% Y4 g- p. z" g: t. L
}
$ b l& Q7 o" I$ w; \- K- h) k opener.form1.frecname.value=val;
& K$ ]$ z/ d9 s2 | self.close();& A( w( `) ~9 x9 r6 M; J' X
}
. I8 N% D* n, S' ?4 S//-->
% I1 w! p( t8 W</script>+ V/ P% y- f# z/ H
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
+ b' Y6 L/ D6 |<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
- f0 F& X, `( y' }<%
" j$ t) ~; k5 T1 U. B6 R+ M0 d cdatasource ds=new cdatasource(); //数据联结bean实例( r* y, L7 ?, ^5 a5 ~- R8 P' V1 @
java.sql.connection conn=ds.getconnection();
6 n3 `7 a. m4 W# v# |3 Y java.sql.statement stmt=null;
, H t6 ~; n9 R- t3 [) w java.sql.resultset rs=null;
' b& ^. `! M ], T1 T) x- T cdatacheck dc=new cdatacheck();9 d# m2 Z3 Y% y8 o' \, N% R
%>
2 ^4 l8 D+ ~5 m<%7 \1 w" S) \; }$ f9 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";
; `" s* G% T! q- Xstmt=conn.createstatement();) r' i9 x+ P Z' h$ [
rs=stmt.executequery(sqlu);
( q: d& b) L! c/ U& c%>
8 l0 Y7 p$ m0 u' P3 y<script language='javascript'>* Z' {9 {3 U/ z b+ u
arr = new array();
, s, b. A3 @7 w& ]* [! \<% int temp=0;
, d3 P* f F; K2 |while(rs.next())2 y+ R. V: ~0 h! C9 C5 s2 J
{
" X z# k% }* T2 l: G5 ~ I3 w) U%>% k3 v) Z1 T: {& s$ f* r# \
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
, w. g" X% Z7 B" A5 e<%
9 w \5 p9 E% q" m" V, ?4 e# ctemp = temp + 1;7 I; C' r6 V6 N7 Q
}
. J3 r$ x5 a# A: [4 ?3 z%>+ O8 G7 V) ?/ u
temp=<%=temp%>;
5 \& X, u* u/ w8 I4 U# T8 A% `function changelocation(id){ + Z- l9 k( |" K; a: g4 S
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
. k9 u" X! p7 o: d: Uvar i = 0; # W, |) j8 \' F( z w- k, X6 s, L
document.combo_box.city.options[0]=new option('-------',''); 7 `6 Q( |" i4 @" A
for(i=0;i<temp;i++){ 2 \3 H5 Q1 a8 d4 y' E/ ]7 Q
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
s6 [5 }( _3 `9 f; [' Tdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); 9 T) s# C- L- t% J8 F4 F+ X
}
/ U6 A4 L3 h: F}
! X) \" t, g" Z5 \3 y} & T6 n2 C( F/ F4 L& t
</script>
/ h& S) ~/ A" }3 ?6 o8 w" g: b% U; h- p% B! t( i8 L0 E5 H# x9 ?
<form name="combo_box">
, L9 H+ P; h% e) F8 B* \$ C) |<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
, j( l9 r9 f3 j0 W+ l <tr height="24">
7 s. D+ Q) R0 i" v4 j7 i <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
# b, W- v) U; p' Z; U8 ? <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
5 l/ h V- ?0 g <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>1 ^$ q- ^. L' d0 ~# s
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
9 L. B0 g9 z i9 V </tr>" W/ x" c( M+ H" e0 F$ U
<tr>
& o; k" b9 j l: M1 V' h <td>
/ U2 u& X6 X. t3 Q+ b5 ] <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
8 `' w( v4 d, a4 z9 |; q0 m <option value="0">请选择部门 ---></option>- [% q; C* D( R
<%; e8 M" Q, ^7 l' r2 M+ [
string sqld="select * from tdept";
/ h( X0 j( N2 Y: P$ ?8 kstmt=conn.createstatement();3 N' @6 f# n3 u! q$ }: W: O
rs=stmt.executequery(sqld);
3 K+ N' [6 o: d" G/ x8 w& N) Owhile(rs.next())
) w+ f$ w) ~ |& U8 {" a; ~{
* E) s2 ~' ]/ l7 N; H8 K%> U7 @& n. w5 H2 ?2 T5 Z0 x3 z
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
8 n6 y0 j$ j) u3 Y+ A4 H<%) p9 s" y/ v2 T) J, f9 L- d! Y! p
}* u3 W* P W' b
%> 1 v1 D" S( p2 u$ h/ W9 @, a
</select>
4 x) ]' r6 m% C1 `1 r0 b</td>7 g9 I: Y) X) i3 S, a0 D6 c
<td>
( `# l- a7 i% y <select multiple id=city style="width:150;height:200" class="bgc">
9 z# u: x* V+ D7 H </select>' w$ V+ W" R" I8 J: b. G
</td>+ @! G2 I, d& o$ {8 M% t) ?3 G& [% A
<td nowrap align="center" class="bgc">
. T3 b, z7 j5 E# D2 c <input type="button" value="<<" class="buttons">, d7 G4 _6 `% R& y
<input type="button" value=">>" class="buttons">
4 y$ D4 F9 g7 d6 D+ f6 Z</td>: A+ \1 {: A4 ~! ?+ d
<td>
+ e3 v7 E& ^8 R9 t <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
" Y: [9 f+ t- y5 y/ ]! y4 ^. M: u4 @ </select>
1 `3 [" u! i: Z" T/ I2 L</td>! O0 g* c' j8 W( i# s+ S
</tr>4 [- f7 p& X' i! \" c
<tr class="bgc">
( |0 a, L: e' n6 g- y) N0 W+ S9 ~ <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
2 y1 W4 _% N4 V6 V7 y& L5 q7 b </tr>
' E- w& D8 c; V8 Y. m' ~9 I7 z9 [</table>4 z& s, A) g8 |7 ]9 C* L
</form>
& _: g0 T* E: P# `0 l<script language="javascript">' f* h: W8 {, n
//人名移动
( \& I9 W3 n- N' o" O( I/ pfunction move(fbox, tbox) {
, T' P- {$ C$ ?! o. Pvar arrfbox = new array();
7 J5 ^; }0 z* F2 N9 C% ^2 Tvar arrtbox = new array();+ d# x6 S5 X4 V- w
var arrlookup = new array();
3 @5 t' h2 M& i8 S; m8 G0 ?/ Qvar i;" h5 X7 D7 I* \& t2 r
for (i = 0; i < tbox.options.length; i++) {
+ T. s5 L' }/ f, }0 v. ~: Aarrlookup[tbox.options.text] = tbox.options.value;% g( r3 h- ]7 K$ K+ l8 ~
arrtbox = tbox.options.text;) B4 f' J0 X( a4 u9 |- |4 l
}
) {8 W! _' h( svar flength = 0;' r* c2 K* v2 O4 b9 ]
var tlength = arrtbox.length;
5 z, R# b0 u+ b* b$ tfor(i = 0; i < fbox.options.length; i++) {/ m$ g/ c4 T" q; W% s$ }
arrlookup[fbox.options.text] = fbox.options.value;
m" W* T" l+ T+ e, m1 {% sif (fbox.options.selected && fbox.options.value != "") {
. [% r: p2 S( A; Darrtbox[tlength] = fbox.options.text;
s0 D# q. R& W: t; N Atlength++;: D1 F1 O1 ]6 j+ c" l) q8 p
}* q- Q# g# X0 C# B/ x" Y$ V$ A% E
else {
/ u+ b( o4 a2 H% b6 b0 p0 yarrfbox[flength] = fbox.options.text;
h: T# U% X2 pflength++;
( p) J' _, T( T4 L% J7 t/ V1 | }8 A/ v3 a! A9 E1 ^
}
: v5 h# k3 h1 N8 M/ M# Darrfbox.sort();
2 I$ J# K: e7 ?+ s3 T6 Marrtbox.sort();8 Y9 ~1 E, |* P
" ?( l f* q# H! G, q7 cfbox.length = 0;
+ o; M: u! P, p* H9 m" `4 btbox.length = 0;
" \( m8 D3 W! ~0 g7 rvar c;
: ?7 y8 Q6 g' w( V7 b7 |for(c = 0; c < arrfbox.length; c++) {( \3 ~/ {. n" Z& j
var no = new option(); O$ v c3 L7 K% B8 I) N
no.value = arrlookup[arrfbox[c]];
6 P \- S Y ?9 ` @: Eno.text = arrfbox[c];
, P# {: k# b& |7 Q6 y! W4 f& nfbox[c] = no;
O+ K5 q; S+ c}6 U7 e+ {1 H/ ^8 |
for(c = 0; c < arrtbox.length; c++) {
( G# [- j$ N6 T7 B9 ?var no = new option();
: e9 u, t4 B0 g1 A1 v3 a& [( vno.value = arrlookup[arrtbox[c]];! w& B# q$ U; k* g/ n
no.text = arrtbox[c];" i0 ~! e% L- K
tbox[c] = no;% A( w3 f6 g4 B' e
}* U C& M3 ~" B( T! {# [- b) d- `
}
1 d9 H$ b- B: p$ _</script>
8 e" ~$ p" k* }4 \/ {' E2 S5 M</body>
: ]' t& h, t) y' Q' [9 E+ [ |
|