  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14197
- 金币
- 2389
- 威望
- 1647
- 贡献
- 1337
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"3 ^9 t7 G0 s1 _$ }0 {2 ~
c pageencoding="gb2312"0 a8 N8 V5 M2 [8 k$ C, ^9 _5 s6 p6 k
%>
4 e7 V4 X& A0 A8 f<style>
# K7 `8 q* |, c4 E1 }) ?9 y4 z9 q.f9{ font-size:9pt; }
0 D, {* ^1 F5 X* z.bgc{ background-color:#aecaf9; color: #0033ff }
& y. Y& R- a) X6 c% ^.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;2 {; n% H6 x4 a+ q8 ~
border-bottom: solid 1px #4e7dc1;
" D: E2 Q# g0 Z5 I1 ^) V( ] border-left: solid 1px #aecaf9;
. W9 Z3 T/ V: h) A' o( } border-right: solid 1px #5679bd;
& U! l* {# t D) U padding:1px;
, z$ I$ @% n6 A* {+ V( x" ] margin:0px;}/ g8 N6 _6 S# x% X
</style>( s5 `6 B* ^& Z
<script language="javascript">
( f& E" ]1 J: a0 U<!--
/ W8 _8 C0 A0 K- `, f) ~function rv()0 n/ e% x! n: m# D0 b. J
{
" |# ?$ K' l" N, c4 X1 b( F var val="";' p) o+ d& w0 x7 G
for(i=0;i<combo_box.list2.length;i++){
4 g& j$ ~! e9 i. Y) o+ ?' E val+=","+combo_box.list2.value;- T; E A8 A0 U" M4 F0 K- |' j
}
! w$ j+ W0 A3 E/ \ if(val.charat(0)==","){
, x) }3 j4 E1 M" C! {1 w val=val.substr(1,val.length);3 e% a- Z1 W4 y' @
}7 c' I, I1 |" ~" T: x, h/ l" j
opener.form1.frecname.value=val;# c! b3 V. J, ~! h# g( }% e
self.close();* j3 v% X) @) f$ q# E& e5 r+ ]
}
$ N" d" U$ [* f1 D$ M//-->/ N9 ?. J; C s# `; a1 C
</script>
% Q$ p( @5 _8 R% Z8 E j( Z<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">4 Y2 A' j+ D. Y0 {2 f% v% \
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" /># [+ C) i* ^. ^1 O. i
<%, w1 y6 t1 Y3 B; }( k# B/ `
cdatasource ds=new cdatasource(); //数据联结bean实例
) o: O5 S* t& o( ]7 B) l java.sql.connection conn=ds.getconnection();
. y7 @$ S1 i4 m8 a8 k java.sql.statement stmt=null;" l+ w, w8 l, L" }+ R6 K: D: c
java.sql.resultset rs=null;$ p$ V3 z/ P5 a4 a- k- N
cdatacheck dc=new cdatacheck();% @2 z2 X3 w: P
%>( T# P8 p0 A0 [% y# r
<%
" C( {$ f% B2 E7 j. \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 Q$ P' G0 @' z2 r! [
stmt=conn.createstatement();
9 Y; L0 ]* {2 h$ P2 h% |rs=stmt.executequery(sqlu);* _8 w) v& R8 l+ ~# K2 G
%>+ a- W: O5 i1 [5 f) i
<script language='javascript'> g( @, m1 [+ o% S
arr = new array();5 D: X* y8 [8 B+ G
<% int temp=0;3 c4 \3 P" j' F2 i# g4 s7 A% S
while(rs.next())
# R% k9 S1 F# \5 S7 Z: a3 s{ ^- \2 E6 w$ M" h: N5 Y& P( d# M# D$ o
%>. P+ @* C4 ~4 f4 w" F
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
S- Q# j4 f4 b4 ]( N0 K<%
* @* }+ B" g3 b2 ~temp = temp + 1;7 Z# f6 ?6 x' {
}
/ `" u5 _% Y5 l4 Q, |1 k& J6 k%>" s5 p/ h& w6 S, [! B: t
temp=<%=temp%>;
' G `: m* k- Ofunction changelocation(id){ 7 ?4 I& h$ e& E3 F. D
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 6 N! @+ K# @/ Q5 w/ t, u
var i = 0; ! E9 F8 J+ L0 d6 P2 N
document.combo_box.city.options[0]=new option('-------','');
- _/ X/ t4 k- a. Nfor(i=0;i<temp;i++){ ! T, I. O" K k. \
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
6 w2 L1 Q e. k* A0 Wdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
3 {9 f3 ^' Y9 w/ z5 Y7 Q}
5 P' d9 ^; Q$ ^$ f! c}
. _: d2 a0 @* @( K- D}
/ y; \0 c% \$ f- R</script>
. ^/ e2 s' E3 ?( @& p' U1 [. s) s$ j8 Y1 K _% v
<form name="combo_box">
% {, M! G) n2 V" w( X<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
' r# Y! y, K; M5 h% l0 S; q <tr height="24">) y1 ?# x2 C; a# b2 V# \
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
. t$ h6 {% m8 M4 s <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>8 ?: k8 Q, ?9 w) J
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
2 k- H2 T# M, L( [+ n. F <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
0 b# o! b5 q5 ~, ` </tr>- B: D; Y. J/ e* I. h" ~! M
<tr> ! Z# \3 u6 N5 u9 K2 n% ]% N
<td>
5 s2 e7 U0 b6 d+ V4 g5 ^ <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">2 v% O6 L8 ]; [: i
<option value="0">请选择部门 ---></option>
- N( S7 H7 R& W1 Y* D* `: k9 ]<%# ^& m2 P; c, L& S0 a8 ?: m \3 w# Y* ~
string sqld="select * from tdept";
7 b& s" P3 J& ?. z. \3 dstmt=conn.createstatement();0 C- b9 o( o5 @! s, I
rs=stmt.executequery(sqld);1 W; Q( a# ]) d) T. f0 g
while(rs.next())8 B9 F8 K9 f: E/ F2 Y9 d" Q+ W
{9 t: r5 ?# w" Y& I- {1 a& ~
%>
3 r7 L( L/ @/ ^ d d4 W$ c. T- ` <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
( F& n# @% Y* T/ S4 D: L0 k/ D) H<%6 K$ Z$ ~* A9 c2 C, k2 x% M/ {$ }
}
! b+ Y( l( L9 |$ N+ e%>
( B" F+ k. G G </select>
2 d! k' H8 l- W+ U7 O! F</td>
& G: u; D `, o <td> x, t/ s& i1 x* {# ?+ O s
<select multiple id=city style="width:150;height:200" class="bgc">- S7 ~+ o& c- m( ~2 k
</select>/ [+ D W/ Y& t7 o
</td>
& J7 z; [) |, i% `! t9 D7 { <td nowrap align="center" class="bgc">
# h8 j3 b% F( k <input type="button" value="<<" class="buttons">- w: Q' W' X" ?/ t
<input type="button" value=">>" class="buttons">2 T0 M" T( _' F5 q5 ~4 m2 c
</td>. p t3 f5 W. p
<td>
) j3 Y0 {% c" S( { <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">7 [9 ]+ U% o. ?, r" `
</select>
* g0 e+ e r0 J7 j</td>$ C' r( ]7 M* S/ a) K4 D
</tr>% h0 P( g: B' t g* j6 D/ T3 r
<tr class="bgc"> 6 v: r( a+ j$ Y3 A
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
- i7 p$ M5 i6 ?( L d </tr>* i9 c& c/ K& ?) b
</table>
! U6 g- c R+ q6 C</form>
% _/ w! Z0 H7 m8 u2 y3 a<script language="javascript">* s" A: F' _ f/ C% n
//人名移动- |' q, T7 D( H5 G4 U" _0 F5 b
function move(fbox, tbox) {
@+ f9 D/ \- d7 N- zvar arrfbox = new array();3 v8 z( W& o6 Q/ E1 \4 d
var arrtbox = new array();
+ }, x- ^; i* R- Ivar arrlookup = new array();, [7 ]( N$ A) P2 ]! _+ N9 t
var i;; f% [% f- S. |* V V
for (i = 0; i < tbox.options.length; i++) {/ f- |+ D/ b6 E# n
arrlookup[tbox.options.text] = tbox.options.value;: R) J2 w# l7 G' e% e' J, L
arrtbox = tbox.options.text;
2 g" z2 u9 a: @" S1 R}
! u1 n6 @( ^1 l$ t( lvar flength = 0;3 w' U# y0 y' v' n3 m
var tlength = arrtbox.length;
8 h# V& F, C- j4 Y' @5 m' k1 ofor(i = 0; i < fbox.options.length; i++) {! H+ r9 A; l4 ?, z& ], Z3 L& ^' U
arrlookup[fbox.options.text] = fbox.options.value;6 Q" A, P+ g6 C% e; J+ |- k( Y6 Q
if (fbox.options.selected && fbox.options.value != "") {
8 h; M/ |5 w9 c* y: Q9 Iarrtbox[tlength] = fbox.options.text;4 D7 t* b' _9 F
tlength++;; j$ q, o8 o3 C2 y
}* ]' ]% Y9 [& p6 @
else {
) g' w, I3 G6 r6 C- k+ barrfbox[flength] = fbox.options.text;
* \9 q4 c+ i8 B4 k! `" Y: mflength++; e. y, @5 U8 c! Z) a0 R4 h2 Y' ?
}
8 p3 g; r; w% A' b' u( }" ?}
! D8 ^, W9 T" w- Sarrfbox.sort();
0 w! E" x. _# F& [# O5 C% }arrtbox.sort();
& {' F O; G0 {& {- H. R" z; d D# T/ I5 w8 j6 v
fbox.length = 0;
* d5 U4 N/ X8 ~tbox.length = 0;, c _3 k, a$ P) ?1 U1 L
var c;
8 {7 M# R4 q Dfor(c = 0; c < arrfbox.length; c++) {
7 z: E. A- i: N. X( y+ }, d2 ~var no = new option();4 r& D" U7 I! N( q0 G
no.value = arrlookup[arrfbox[c]];9 L1 _8 `4 t9 f* n8 Y3 N
no.text = arrfbox[c];- T1 M, Q W* k6 r
fbox[c] = no;
# G( l. N# x8 p/ [# A% J0 l}0 F u# N2 E; Z) E7 B ~1 t
for(c = 0; c < arrtbox.length; c++) {0 k6 X7 S% t) O' m: P
var no = new option();5 k, ^, k. S% O( o
no.value = arrlookup[arrtbox[c]];4 X: _, i$ K7 j0 f/ [4 Y
no.text = arrtbox[c];. e% i( u# M8 u0 X% l
tbox[c] = no;. @0 N) ]% j0 r" v+ e) ?! o2 |2 n3 U
}% v h% |- F! s
}
% j( ~( q* I: m2 k4 X</script>+ L; J$ e3 ^5 w) P5 A5 }
</body>
$ y8 r2 u4 e, M }; V/ ] P1 Q |
|