|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14329
- 金币
- 2450
- 威望
- 1647
- 贡献
- 1398
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
3 n( x ]1 C1 k c pageencoding="gb2312"" ?* I8 ^$ c; s, h9 t
%> l) d/ Y i& k% s
<style>( h: C4 M6 D8 ~# O' f5 t' @ @
.f9{ font-size:9pt; }
2 N. x% R3 w" `; W2 C& w.bgc{ background-color:#aecaf9; color: #0033ff }0 F3 Q) \' v* Z+ D/ u
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;+ `, Y4 [# u! z& B
border-bottom: solid 1px #4e7dc1;
/ i0 G+ j2 ] F& s border-left: solid 1px #aecaf9;$ u* E( Y2 R. |0 J' J# D1 @- y
border-right: solid 1px #5679bd;
, P4 C; f/ z6 W3 p* F/ [4 _, b5 f" g padding:1px;; X" {5 S5 w+ x) k
margin:0px;}
' e3 [) t! x' v7 a( a</style>
* {* ~" W$ W* ~" h" r<script language="javascript">
- @7 I- ~) y7 h; i3 b<!--. D# R, ]0 |$ S. ~! }8 i; q
function rv()
/ l/ L8 S6 l( i" r k{
; g0 a# e- ?) x8 h var val="";
+ ?7 s* g& d( [% ~. N+ i for(i=0;i<combo_box.list2.length;i++){
# c3 u4 K' g. R3 f( c val+=","+combo_box.list2.value;
! m) L2 ?# |1 H; o$ p }
# N1 h7 m& l$ V, R/ v0 K if(val.charat(0)==","){
9 p8 C& i8 r W8 ]( O; t9 g val=val.substr(1,val.length);
( j3 X. x. H+ D( a6 o; W$ E0 d }
! C7 P0 P3 b+ i$ Q+ Q opener.form1.frecname.value=val;: ~; |& |% S$ p3 f& A) D1 |
self.close();/ n8 X7 X/ Y! n/ V( S8 U; {$ \5 G
}
: ]! ~, [/ ? ~, ?; C, ?% k//-->/ ~7 b! a% U0 v! t( Y. J
</script>4 ]* k, i1 j- ~
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">4 Q- F2 l* O' D/ ~2 j/ g4 U" j
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
) }0 h6 Y. g# A2 k( ?5 d) G$ H" U0 R9 ]<%
% t4 M4 y. o: r cdatasource ds=new cdatasource(); //数据联结bean实例; Z1 H. I8 l$ K+ x
java.sql.connection conn=ds.getconnection();
) [9 n3 p* _+ Q3 n java.sql.statement stmt=null;
8 N: D' K& s/ L+ T/ {3 w9 { java.sql.resultset rs=null;
4 I" C; _0 F" s! L% i" @% D cdatacheck dc=new cdatacheck();6 Q3 u8 E$ k, I) X* T# L8 d
%># o4 ]: h( _" K
<%) Z+ v" k$ X" ~9 G6 D6 q0 {- u( D0 e
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";
' M; p! i: p" Fstmt=conn.createstatement();6 P9 b+ s: b1 x+ v! ]; s0 z* y, x4 Q
rs=stmt.executequery(sqlu);9 H7 k4 F0 A+ s/ B! L: A
%>2 Z" Q* [/ D2 S% t% ?
<script language='javascript'>; z3 y8 _6 |/ Z
arr = new array();
. p4 ?( e3 c f8 p7 {# m<% int temp=0;4 e+ j" L! v: [8 U6 r7 ~
while(rs.next())
! d. M3 a3 R, \# T{
8 ]# Y% a" e% ^3 z+ L* K%>
4 {% c% Q. v# @2 T9 l7 jarr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");$ O/ }( P! d6 V5 k- n1 t: T5 e& S
<%
1 I2 h! M0 ?- X) H- x' otemp = temp + 1;
8 ~* u6 K2 m" e$ |+ C}
# t7 W3 {$ u% \- f% C% u%>
I9 Z3 W# Z8 [+ {7 Itemp=<%=temp%>;9 a3 E2 E0 A1 {2 a0 q
function changelocation(id){ $ J3 l' b3 a5 W$ F
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 ! n' N5 A3 S4 x# U! [
var i = 0; 5 l$ ]) i* ?% U# s3 F2 O5 H
document.combo_box.city.options[0]=new option('-------','');
) w7 U5 s/ @% `for(i=0;i<temp;i++){ " f, @/ C3 t( |+ E
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] 5 w) z w/ D* i
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
- Q9 h$ |* d$ U$ Q' L+ r& Y3 ?3 ?}
: f2 K' _* N. R}
- N( b! v8 f/ c# }6 g}
0 T: U' I5 C7 v/ b- U</script>
: R l/ g3 D ?; d& @4 t- u5 q, G+ C# `3 g y, {% `- a' Z+ T% i
<form name="combo_box">! N% R/ |8 h1 ~. b7 C: C
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">7 Q% `4 u. B3 v. U r
<tr height="24">$ s1 I6 t! f; K$ S2 \
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
7 M5 X- C, |' ?2 W% J& C <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>3 Y+ x$ N- E" K; }: C
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
4 U- {; y; }" Z <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
: I3 s7 f4 @4 N: e/ z </tr>
( i: ~: `& Q2 Y/ ?3 S <tr> # t t( N. j& u, m& i3 |8 l
<td>
0 h- W7 \, J# a <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">9 j/ |8 M+ u3 y
<option value="0">请选择部门 ---></option> g% `% n3 B% m$ M% ?( ]
<%
1 g5 c4 R7 s Y) V! |7 i) b% K string sqld="select * from tdept";
3 A$ e, I6 S$ z# L" V, C3 istmt=conn.createstatement();
: ~/ i2 t1 Z6 B( `& irs=stmt.executequery(sqld);& m# C, v/ {2 e
while(rs.next())
1 T2 N( S5 M+ r! H{
; M/ h% S0 b+ }) t& u+ L%>' M* @0 H& z, ], z# [
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
$ K( t# u/ t! {0 T3 [% Q<%
# ]0 Z0 G6 T) Z+ f1 X}
5 S- f5 i1 Z/ L%> 1 i q# P9 |! ^/ m4 o' m
</select>' ^! W1 _1 r, K7 {
</td>
$ K; Q# E7 x# { <td>
Y9 o; e( h0 Q4 P- C4 Q0 b <select multiple id=city style="width:150;height:200" class="bgc">! F' R# {1 V1 \3 w; y
</select>
& G& s& W% \) |</td>" p8 T, O- ?: _- D9 {. u4 J+ B% Q1 |
<td nowrap align="center" class="bgc">5 T4 j& _/ S6 f. W: t2 l
<input type="button" value="<<" class="buttons">6 P4 D3 \$ e; y& ~( I$ Z* _
<input type="button" value=">>" class="buttons">$ B6 {7 R8 n! R/ v5 O7 u, N
</td>+ l2 a6 [, g, J7 e
<td>5 D- V+ v; V/ b
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
) v3 q# r) o9 D! t( }9 u </select>
; w( p" |0 [3 `0 M0 T* a/ f( j</td>; P1 }- B. C' \+ G( E3 l
</tr>
0 I+ A! Y+ F9 ?, ]- w; K <tr class="bgc"> ( O2 z; D3 E& I# e
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
: I. @8 N" A" Y2 R, l </tr>
6 o% V: b* G) W( ?7 E( Y</table>
( i1 Z9 E4 \! N5 h! S</form>
" G* {0 x; J3 g$ x<script language="javascript">
' j& a5 k! B2 w$ h: u& D//人名移动9 s$ u$ r- { R! _+ q% L( i9 V
function move(fbox, tbox) {
: B% N5 D2 g- C/ j% R* ^var arrfbox = new array();
! ]( V3 t% M; y3 `1 d; N! tvar arrtbox = new array();0 E! U$ r; q# j( E, f/ R, g
var arrlookup = new array();
0 W) y2 } {; ?3 O; Ovar i;
( S* E: |; j' p6 u" rfor (i = 0; i < tbox.options.length; i++) {5 u1 I* p, o' z2 j2 ~# F% Z* d
arrlookup[tbox.options.text] = tbox.options.value;
& q% T, H8 T9 j; o" l$ F5 ?arrtbox = tbox.options.text;
$ @* B7 }: e. O4 i1 ?, t) X( G}
9 Z5 y) r8 M- U( J3 a4 x7 p5 Pvar flength = 0;
0 W* n9 G T, {8 F( Q2 f' yvar tlength = arrtbox.length;
3 \ G0 A/ t# E0 efor(i = 0; i < fbox.options.length; i++) {. i' f/ m# h4 h x' Z @5 ?
arrlookup[fbox.options.text] = fbox.options.value;
# p! e6 C3 M( X) ^) b2 D5 Gif (fbox.options.selected && fbox.options.value != "") {- e/ |5 A5 \0 t) T( n( b4 Y
arrtbox[tlength] = fbox.options.text;2 n2 @: O; x- ~; v3 {+ R
tlength++;
' \+ D8 U" ]1 `# {/ j2 s9 e: i9 g}
5 B5 B: x! o& [else {
. a+ @9 Q3 j7 T5 u5 Jarrfbox[flength] = fbox.options.text;% b, Q+ G/ b" l" r/ B# Y, R( M9 g3 G
flength++;2 \; Y4 y' `# j( a
}( E4 @& |' Q& [- O* O
}! k/ W. W5 j1 }0 x& H
arrfbox.sort();
* }% F' B* P! {$ _; \/ p G3 yarrtbox.sort();
6 o1 L6 C9 B& V3 |$ U$ u# S" C x; v& |/ F. W
fbox.length = 0;1 L7 l9 c O0 t- |- B0 W1 Z; A& D
tbox.length = 0;' m+ t2 F/ F- [1 S! G) b
var c;9 g0 g' q" ^% y/ i
for(c = 0; c < arrfbox.length; c++) { i7 E7 j( Z0 ]* C$ S
var no = new option();* c! a. N4 P+ J
no.value = arrlookup[arrfbox[c]];
2 `+ B- f! y9 Ino.text = arrfbox[c];
. }5 Y( V' p8 C, E l+ `' Sfbox[c] = no;9 b' V$ J( Q! s& y g7 _
}: `6 D! Z9 @$ ~# E
for(c = 0; c < arrtbox.length; c++) {
1 l- w7 B8 I# _& N) v8 o/ F7 |2 Qvar no = new option();: e0 d/ b0 R% l
no.value = arrlookup[arrtbox[c]];
' U1 b) X2 B4 ~% Lno.text = arrtbox[c];
& c1 B) y! x+ M5 G; btbox[c] = no;8 M! u+ R% N( V# c& L9 z# R8 B- x
}5 q- `' b- n" @; j
}
% J& S8 @/ K* e0 _</script>
9 k. e4 Z- \9 {5 x9 o</body>
( ?; o. A/ {$ @# q: n' ` |
|