  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14221
- 金币
- 2401
- 威望
- 1647
- 贡献
- 1349
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;". s) X! e9 M1 ~5 P& x
c pageencoding="gb2312"& n0 B' A: @7 y7 ~/ ]
%>& G! e) T! Q F
<style>) d6 Q: c& O) x. w4 U. n8 k
.f9{ font-size:9pt; }
* I4 L" i+ W" \7 t* q.bgc{ background-color:#aecaf9; color: #0033ff }. o3 @( I4 E: s* \8 r# ~
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;, `" n' @% s9 w! L$ _3 i0 B
border-bottom: solid 1px #4e7dc1;
! A `) ^/ h, J9 z, [ border-left: solid 1px #aecaf9;
' V3 q d- W' x" D8 Y; m4 C. o1 N border-right: solid 1px #5679bd;9 G0 R7 m& H5 T* m6 u
padding:1px;) ]0 \/ v9 v/ c4 C' @* i
margin:0px;}
4 X U) V3 {9 A. y) `4 Z R+ l</style>* N+ a) J. q- [2 n; o- O
<script language="javascript">
4 e4 J; s0 s( {! t, I3 N4 j6 V4 h<!--
9 J7 C" Y( q3 i0 }function rv()$ w) z' P5 a1 V5 q& d
{
; c; z- K' z% h/ O; _5 D var val="";% c7 r1 E0 m+ I
for(i=0;i<combo_box.list2.length;i++){
' R7 |9 f4 K5 Q6 D. X val+=","+combo_box.list2.value;; s4 q7 B- e' @/ ^
}; w# y8 R! G3 v" j# {8 z5 M
if(val.charat(0)==","){
# D) W' H, ]7 |. o% Q; m5 Z val=val.substr(1,val.length);
: H0 L) F$ i7 \% W; i }% S! r: Q5 |9 g# g5 r5 m+ j
opener.form1.frecname.value=val;3 k& [) ]0 g* b& y: P$ h
self.close();4 F* @3 x8 S5 T3 A/ y+ O$ t; H
}
; n5 b1 s# W' O! ?: b, ^//-->
, X! ? j) j8 ^/ H8 l4 J</script>
( J8 ~( h: T# e, B6 m H% \<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">) ]3 `% Z7 C* |: Y
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" /> T% }. U$ V. X; n3 t) @" }0 P' r' Y
<%" r( c1 y1 d" {6 w8 i
cdatasource ds=new cdatasource(); //数据联结bean实例
. j# p; {% S0 m( J% P java.sql.connection conn=ds.getconnection();
7 B/ V# u% I& _5 F# Q# w java.sql.statement stmt=null;# a6 Q- M9 W1 L+ c J& A
java.sql.resultset rs=null;8 ?+ a' E3 Z3 e# r7 e% t: P
cdatacheck dc=new cdatacheck();
& O+ B `- \% M- N* ]+ z%>
3 e& E! y! r: R' o; B Z7 P& `<%# n1 \2 _/ Q* w+ 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";
& s' X, E& X* {& \stmt=conn.createstatement();
* |$ S9 H, R) r1 crs=stmt.executequery(sqlu);4 N% n. q2 j: Z5 [8 G! q. d' y" @
%>
/ k d* |1 i4 Q4 ~5 C9 ]<script language='javascript'>
# |: G* c* }* |3 s" _5 ]$ M2 karr = new array();
- ]; E3 e% f$ W* q<% int temp=0;2 R' {/ I& l) d
while(rs.next())$ O/ _. @; L: c$ g: O' P3 X7 l# J
{+ l: S$ `$ W0 _4 W6 z6 G* B' [, s& Z
%>
- T( H0 s# A! i) H0 karr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
6 g# s2 ]4 k" n<%
$ k; X4 K: L4 Q) C% @: ]temp = temp + 1;
; c% b- {' \6 N: \( E3 ~}. T( X* \- U; A4 J
%>) _7 Z# s! Q! M: W/ {; ?
temp=<%=temp%>;
! b$ E0 {$ @7 M- ^: G! yfunction changelocation(id){
; }8 @/ @# G7 B! W8 N d5 xdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
* X0 E* Y$ O- e2 R8 Svar i = 0; 8 [! D, [/ ]: a- Z9 H; H* I, K
document.combo_box.city.options[0]=new option('-------',''); ' a8 z" c1 j, R$ S0 P7 s
for(i=0;i<temp;i++){ 4 o" L7 T8 |' i8 e, D
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
$ I6 E2 O z4 i/ mdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); n; C9 Q7 w& B1 `
}
5 H' ?8 W; e* X9 Y$ m' S}
0 J- O% m4 K ]1 `} 2 |+ C0 G( k. x- |! t
</script>8 s) r& u9 J! h3 G$ J* j" S7 l# ]6 J
V1 `( x$ P. j% ^<form name="combo_box">7 E# t6 V ^2 V$ ]' x; u4 } H: |
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
n$ R. [: E' L T1 `7 a <tr height="24">4 _& C& F1 Y/ m, z; ?* u7 R" W: ?! R
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>, v- ^4 i" S5 j; q
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
7 V/ F W. `0 i: o. P( Q3 D <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
# ?+ _; w9 q& K6 \+ J <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td> B! O# O$ ^) D! Y# X9 X; t
</tr>
! E+ R! s( |) ?: A" s* d$ F: r <tr>
+ m" X& ~% k+ Z1 _3 I <td>' b: x5 E- B8 ~. X `& Z
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">' l& `# F* r$ X! s& q k7 a% x+ m, `
<option value="0">请选择部门 ---></option>% o9 @& n3 w7 q; C
<%
3 A/ ~6 Q: ^; [" e0 T$ ?+ ]1 U t string sqld="select * from tdept";. P1 `* H( P% L6 c
stmt=conn.createstatement();" r6 F: e3 \) R1 K
rs=stmt.executequery(sqld);. ]( b/ a7 M. J* ~6 v8 a4 ?* b
while(rs.next()); o" c! ~. w0 A v! V( b6 ~$ I& Y. n& `
{* G7 t: e4 l, a. E( l" I
%>
1 U4 ?5 k' j; Y) L5 ^ <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>6 r& n& j' ?! O# d
<%% z/ z. u8 q6 q, ]. K5 A: O3 ~5 G
}, S& P# q: x9 r0 `
%>
" z# a8 m0 x3 c3 f" r& I- [6 H5 P </select>( z) Z+ d; F: M% d1 o8 t6 C t& Y: l
</td>- t# h. X# S& U/ H( C
<td>
; ? r- K! ]5 G i- A" ` <select multiple id=city style="width:150;height:200" class="bgc">+ [. @% |6 _) G" X8 H6 x
</select>
2 N4 S) _3 d" ?4 U1 T8 J</td>- F1 M9 m& M r" B
<td nowrap align="center" class="bgc">. u8 d% h5 Y+ E) r9 k
<input type="button" value="<<" class="buttons">
$ s* X& i, D' |+ W <input type="button" value=">>" class="buttons">, L! O/ U+ O& n# @$ i& D2 d
</td>
% \# H7 O% ^4 m0 j( ~8 i <td>. a4 y5 H0 h$ K" F1 C: v
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
* C4 \, a6 _7 N3 V9 U2 l) r; v$ E </select>
5 B/ [8 e# Z! d- p* {</td>' K/ C$ H8 U' c0 t: j
</tr>
5 e- O0 l5 U4 P. T' x- {4 u& a <tr class="bgc"> 3 q# _ X2 |2 g3 k, L4 l$ G, |6 x
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
/ K# J+ h: l3 | a6 G E( v </tr>) y1 n8 N( A1 Y. G, ~% u
</table>1 H. T) j* g. n( }$ J5 K C- D# {% Q
</form>, N3 s8 p6 M- q) d8 ~, g
<script language="javascript">
9 Q7 l, E' j5 ?//人名移动
* H/ g7 ], L) u0 c+ M0 R2 _function move(fbox, tbox) {
; v7 C5 s# X& S& P6 Dvar arrfbox = new array();
) S$ ^' k' S1 _/ @7 avar arrtbox = new array();* J, c( A" _* l
var arrlookup = new array();7 G ^ i! N Z& U3 H: o9 u
var i;. b" b6 {$ l7 E( i! H, f
for (i = 0; i < tbox.options.length; i++) {4 ]) q4 l. q' K
arrlookup[tbox.options.text] = tbox.options.value;
0 x4 S& M4 ~4 x9 @- d; X; T Iarrtbox = tbox.options.text;$ N4 E4 W& \7 P! Y% ~
}3 R3 O; r2 R/ j% `: p, C2 n
var flength = 0;
8 v) v- \5 b H1 e5 R7 hvar tlength = arrtbox.length;) m( I' O- d1 K7 {7 v7 \
for(i = 0; i < fbox.options.length; i++) {0 b& g/ {+ }, z* K" F
arrlookup[fbox.options.text] = fbox.options.value;
" A9 {0 h+ Y2 E8 v5 Y/ ^" j5 Eif (fbox.options.selected && fbox.options.value != "") {
: ?' Z) A6 [5 O( A/ `arrtbox[tlength] = fbox.options.text;5 x; ?# s5 s3 w: N; K8 `9 K
tlength++;
|/ ^% S. `- g3 s+ z2 x |6 ]}/ a$ Q# {, V% y/ C& F% R$ v$ I' l$ {
else {
/ i8 O( A' @/ U: ?arrfbox[flength] = fbox.options.text;% c1 o, S! f7 S
flength++;% x4 m5 Y% F/ ~' N; z/ f
}4 q: s* A; C, \! E, d
}! z, W! l. a- ?1 Q* ?
arrfbox.sort();7 L& E7 C9 r4 x. P b7 B& M
arrtbox.sort();/ `5 `/ y8 m+ w! {* _1 j6 U6 c* ]
8 w7 j- b" Z6 [# n2 Kfbox.length = 0;
( Z. p7 t$ h$ c0 k6 atbox.length = 0;
& q7 p& T T& L0 p, y2 ^5 Z$ f8 R' Xvar c;0 s1 ~ n" ~8 _' Y( ?
for(c = 0; c < arrfbox.length; c++) {7 Q6 ~9 l8 E- t( r z! x, T3 Y8 i' }
var no = new option();
Q- ]* N* e) A% \no.value = arrlookup[arrfbox[c]];3 N5 E( b( N0 L: Q: \) N$ F1 c
no.text = arrfbox[c];/ r* t, f5 @1 C4 k$ K
fbox[c] = no;7 _0 z7 `# ~' g
}
0 i# L0 O; f# K/ Z, c; v" }0 bfor(c = 0; c < arrtbox.length; c++) {. q" Y) C8 D! J5 B
var no = new option();- O' t- T! x$ H( k+ p
no.value = arrlookup[arrtbox[c]];3 S/ \1 O8 S8 g
no.text = arrtbox[c];
; x! [/ m, e, w" [/ n, Ntbox[c] = no;
. |! ]4 `0 }) c, l* D3 t; M }5 ?3 c d" D- K0 Q, j
}5 b/ d. c# Z9 s9 i( E' _
</script>
; ~7 R/ t$ a/ K, n: F1 A+ r</body>- k$ S. s, T8 b+ x7 T% L
|
|