|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14435
- 金币
- 2503
- 威望
- 1647
- 贡献
- 1451
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
6 q4 ]0 K Q1 g7 ~; p/ d8 Q c pageencoding="gb2312"# p c+ M* B7 V* Y. i. a2 F
%>' h) U7 l& `# ^& s" ? {
<style>6 L' @! F7 D# G' D
.f9{ font-size:9pt; }
' d, b% R5 k9 b" T$ W1 G" H0 q& t.bgc{ background-color:#aecaf9; color: #0033ff }, X6 _: y$ s+ |$ L8 x ?
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;5 H# Z9 z" L% l
border-bottom: solid 1px #4e7dc1;' [) e: F& X+ y: E1 Y. F
border-left: solid 1px #aecaf9;, f* B% v) W+ r" @3 ?! J! c" C
border-right: solid 1px #5679bd;
7 j, _$ ?* P3 R9 w3 y padding:1px;, K# W, l/ ^, X% b
margin:0px;}
+ M& W- f& p" |</style>
& N. U3 b M9 B7 l+ |$ g: r8 J9 E5 G<script language="javascript">
5 f7 N% E& h, _<!--$ F& W2 |( {8 T. \7 _" A
function rv()1 H0 ~( \) T6 Y& r% ~* U
{# {4 E$ m6 t+ e6 ^! s: W
var val="";& ^* {, U! ~) r$ `
for(i=0;i<combo_box.list2.length;i++){9 b' h9 z0 o$ K, F% M/ m2 x
val+=","+combo_box.list2.value;6 E/ H5 ^* `4 B5 A, l9 k1 m; ~
}
! a/ G+ D0 O9 U# g* d if(val.charat(0)==","){
[7 {( K5 M( H# e0 B2 _6 r val=val.substr(1,val.length);! K* ?' x T. m# E9 N3 d
}
/ T6 t. o* V9 T- d opener.form1.frecname.value=val;
3 B& ~; o; s5 ~9 H4 _ self.close();, P4 N5 K! G1 `; C5 G0 O, F3 j6 \
}7 ^# \. @3 E4 s5 E% d+ V
//-->% n0 F4 l- K2 S* @2 I3 f
</script>, g4 M% |# R# x; \$ G4 Q
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
/ Y4 o0 B$ O* ?" Z6 z: A/ G<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />0 G, y* {8 X# g( I7 [) m, n4 S
<%
9 r6 H) Y3 B- r: U/ @ cdatasource ds=new cdatasource(); //数据联结bean实例
7 F; L; R, c! O6 K java.sql.connection conn=ds.getconnection();$ S+ a) a6 P* l |6 Z- \, `+ R" L
java.sql.statement stmt=null;0 B1 ?, X. ]" T
java.sql.resultset rs=null;; I# ]# Z* [( c7 D
cdatacheck dc=new cdatacheck();/ }6 z+ t% M0 K
%>
0 q' }% F1 f k! ]; O% ?<%
8 A# ~2 d6 f$ o0 ?! B, Q% Bstring 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";" n- j; r' ?% W7 P
stmt=conn.createstatement();
, S, A) |, P6 W7 O+ c' P# ]9 ?rs=stmt.executequery(sqlu);
: X% b$ Y) Z: r* P5 K8 t% p%>
/ l$ a+ Q# I1 U) q9 x: h4 P<script language='javascript'>. S8 \, l" b. Y- \) h" e7 Y
arr = new array();+ k9 _" z* b2 D5 ]4 P- r4 |
<% int temp=0;
! [ p; y2 ~5 Gwhile(rs.next())
. o+ p; b% H [* M4 O* H1 s+ j{
3 i' h# t) Q7 d% n6 o- R- t5 F%>
* ?3 z( F2 I3 i' Jarr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");* v+ ~/ k* \/ p
<%0 i; [* t9 j8 d) k
temp = temp + 1;
& M9 Y' q2 G' a. |1 S9 U}8 I, C6 j+ s$ a4 ?# A! C6 q
%>
* G; m9 B/ W A; ?1 Rtemp=<%=temp%>;) ]3 w9 e% y$ ]. \( @3 n" ]" K
function changelocation(id){
, X7 K- B& d X. l' X0 Odocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
5 v+ C8 H0 \4 `5 @% Wvar i = 0; Q6 N, h! e! h6 d- j- k$ b
document.combo_box.city.options[0]=new option('-------',''); 1 W1 R6 K; k% L( F) y% [
for(i=0;i<temp;i++){ 9 m/ z$ i( i$ V8 G' E; Z9 Y
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] ' y$ C5 f/ L \# n. K, t8 F0 r* G
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
. M, g0 D! ?# s) T" U0 } f, k} % |- U' E7 L5 A& u" u0 j0 |# _
} ; m" q- b- f" D, g) ]( g, e
} : |+ T5 _3 f; a% q1 [0 n2 H
</script>% {& Q0 M# I; d1 y$ `
1 a9 }9 j [5 g1 v0 {& E
<form name="combo_box">
/ Y K5 c+ B6 b<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">3 W$ u% B9 c) f. {' P6 j2 W
<tr height="24">& B' X- \. P9 e3 a
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>! [7 e7 f# x- J! s$ }& d
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>, @3 Y# ^) K- [* u2 \
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>4 @; j4 ~- H8 f4 r( F+ R6 x2 X
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
0 [, V B" V8 v </tr>" I8 `! g; P6 c' @* |
<tr> 4 L' P0 k8 u5 X
<td>* l5 h2 G- A( B% ~) n& W' U
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
3 s/ C% q# E: G9 |9 O. } <option value="0">请选择部门 ---></option>
! w a5 O* R0 F6 e, ?$ E: V+ `' B8 n/ }<%" E% i2 f) U) J1 [' H
string sqld="select * from tdept";' R4 ~7 N& u; `$ Y1 S# ~
stmt=conn.createstatement();+ q, {3 x& z2 m5 G
rs=stmt.executequery(sqld);
I. j4 A# X% Z2 a6 @; Twhile(rs.next())
2 {3 F6 _+ ^4 V% C{1 R. O0 c% k9 [) N! P" Z
%>% {+ n$ Y$ v5 N" Y- g5 n
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
7 m( ~8 X* L% j. N& O<%
6 T1 e; M( S, g; @# X) h}
9 n5 p {) t" y% P# k. S%> 9 o7 r1 m. L# `( s
</select>
3 m k' w% O" ?9 a) j' h+ W0 H</td>
1 C! @# K5 g1 d- l" @( m% Q <td>
8 W# p$ v" M$ p$ E4 Q, N3 O! _3 i' W <select multiple id=city style="width:150;height:200" class="bgc">
) B$ f5 D/ l0 D2 D1 s) Y </select>
. e6 y. t& |8 W$ d' ^& C9 {: i</td>1 u) c, \! B' c( P" R% l A5 G
<td nowrap align="center" class="bgc">
9 L5 h+ S' R/ U& s) G <input type="button" value="<<" class="buttons">
# ?0 m) c8 k# }; b% Z7 a <input type="button" value=">>" class="buttons">
" I" F4 j; f' |, D</td>
# G' k& `5 s& v. E <td>' N, c9 G- p) P6 p) H7 r
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">/ \! }, b! t- Z
</select>" _" b6 L5 @; o+ Q0 F
</td>
1 k* T0 ~: z' V </tr>
9 f2 M' O+ `2 X$ U8 l <tr class="bgc"> : b4 E. ?8 h: U
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>& w( U) D' M4 e0 ^5 K' ^ |
</tr>
+ _4 c: T# k8 M' V$ b7 K</table>
2 n. e8 c& I8 w+ q& r* Y</form>
* v2 [- F0 |9 h E<script language="javascript">
$ A0 Y# R# d5 L. [8 ~. G//人名移动0 ?) T& F; t6 r- X! E7 b/ C
function move(fbox, tbox) {( S, t0 i) Y; ?0 a _6 c+ ~8 p
var arrfbox = new array();" [8 w, @. t. v2 ]* z% Q
var arrtbox = new array();
- h4 E' _; N3 @+ qvar arrlookup = new array();
8 G* _! [$ e, ]9 @9 f4 x [var i;
% T3 g' z( u3 v4 e6 ?for (i = 0; i < tbox.options.length; i++) {
2 x# v( L1 N- t, Z; J! y/ ^arrlookup[tbox.options.text] = tbox.options.value;
/ o# V( S5 t) r2 qarrtbox = tbox.options.text;
& h9 ]* C+ V+ I: d! F' |}. A* A% S% H) N: c g# O. [+ q
var flength = 0;3 \# K" u" o$ S2 \% i+ w
var tlength = arrtbox.length;( j! K/ L8 M% Q" H
for(i = 0; i < fbox.options.length; i++) {$ y3 f! Y; i6 v ?# z; F
arrlookup[fbox.options.text] = fbox.options.value;' i! U4 R# b$ D! d: x3 I
if (fbox.options.selected && fbox.options.value != "") {6 H' _6 i9 n' l9 z" y) {4 s6 L
arrtbox[tlength] = fbox.options.text;" D; ?6 }6 z9 a% n# E- ^- R
tlength++;
* L }+ _' I- M}
/ ~, \ p. J+ T4 W9 ^3 g9 T) ^1 welse {0 k% X+ p: Q6 I6 p! Y
arrfbox[flength] = fbox.options.text;
, _9 Z0 v) [& ~flength++;
( d0 z- U" [$ X9 v }
+ G) U& [8 Z4 f* U$ g5 W2 Q}
4 s6 @* T8 o$ l* s Barrfbox.sort();; t* v$ ?- o; r: n' H6 y
arrtbox.sort();- l8 C0 ^0 T8 @+ S7 L; m2 H; C
: Q( i' V3 |, {8 Q, ~
fbox.length = 0;
8 D: H/ Y* D4 u) C' N) [: Ttbox.length = 0;- H; v0 @$ U3 o
var c;( c, r2 r5 c/ d; u8 ^1 E, ]
for(c = 0; c < arrfbox.length; c++) {/ _5 m; ^/ B4 h* l' _5 o, M
var no = new option();
- y( j' ]" {( ~% F# _no.value = arrlookup[arrfbox[c]];
8 ?/ k) e p5 Fno.text = arrfbox[c];; H) D# d- {0 u' Q, i- m
fbox[c] = no;
) a+ o l! F) `6 B5 ]}1 g7 @; q0 Z7 I9 E5 B& I
for(c = 0; c < arrtbox.length; c++) {
" M1 ~" p; I2 D& |var no = new option();: r7 `- e: e. H3 U& x l
no.value = arrlookup[arrtbox[c]];, I3 k3 w& r& H `: x
no.text = arrtbox[c];, l: n& B- N: h1 G0 L; T
tbox[c] = no;
! S9 @5 ]9 j; G6 E U9 [. c }
, y7 ]5 G" }3 J}
/ }. D& F* j& M8 x5 ~</script>
3 b" e I/ q$ _0 _, y/ k: N6 X</body>6 e' O4 @! f2 W8 n. r
|
|