|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14371
- 金币
- 2471
- 威望
- 1647
- 贡献
- 1419
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"$ Q! H- }0 `/ \3 z
c pageencoding="gb2312"
0 }& ?" L8 ^% _6 A) D- C e& G%>4 v& a4 p. e; V5 t) G. J
<style>! t8 Y1 k* c- y% }
.f9{ font-size:9pt; }
+ Y; r5 F5 q; N9 u7 e% h.bgc{ background-color:#aecaf9; color: #0033ff }
8 F M& U/ Q4 F; `$ ^.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;- h( m4 h7 F4 P, \) j) E) u
border-bottom: solid 1px #4e7dc1;1 b, e/ D8 [3 R7 ^% P$ d; G
border-left: solid 1px #aecaf9;$ Z! D6 f3 o5 ^% O
border-right: solid 1px #5679bd;
% u9 M. @9 J7 a# G padding:1px;
0 Z1 n2 t! w% f margin:0px;}! M7 `: x0 _- d6 K7 t
</style>
1 U' o& O$ ?8 J" a3 v<script language="javascript">
* T( s8 C. R1 D. x: n<!--
# j! F$ z$ j* i1 Q& ~, qfunction rv()
$ Y; K) c. C/ f9 `+ [* R0 y{2 ?1 K( u; J- G6 E5 z+ V: D1 c$ R! B
var val="";
$ E5 Q/ p( ]) a3 W& L2 ? for(i=0;i<combo_box.list2.length;i++){: M. S4 s2 M: b: y7 v
val+=","+combo_box.list2.value;' Q+ C3 P g0 q1 G) ^& c) ?+ Z$ j
}
3 Z0 K+ q6 }6 f$ @( c if(val.charat(0)==","){
0 G8 T% @5 P7 o7 F6 l0 V. P val=val.substr(1,val.length);
6 M) y% c4 f1 o8 W. u' x }& B; ~/ f+ t y6 S
opener.form1.frecname.value=val;+ f' t& x* W2 m2 r
self.close();5 X1 _0 s* X9 s0 t9 `5 l
}
/ s0 ~+ b. s) h& L- |* D/ o//-->
% p* B0 n' {, f( x( q6 K( j' A</script>
" J8 ]& R7 S5 {% X' z<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
. b2 Y7 c$ N7 s4 l<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
9 a& [/ `/ T* J% }& e# U- o2 y<%+ z2 ]4 {6 o2 S
cdatasource ds=new cdatasource(); //数据联结bean实例
! W; ]* }9 d% m0 O4 u' Y( q# b( @ java.sql.connection conn=ds.getconnection();% o5 A- r0 o/ h% i- s
java.sql.statement stmt=null;! ^1 T5 c1 W: H$ i. G2 P
java.sql.resultset rs=null;
( r0 a0 P8 Y% \( r cdatacheck dc=new cdatacheck();! \6 l8 |# x* Q+ ~
%>. e5 K9 Q0 [1 [
<%
* ~/ t9 c8 M+ D$ 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";
5 r% F, i. O* L( ?' y# K, [stmt=conn.createstatement();
! W% i( A8 I3 h- E& G2 R+ R5 Srs=stmt.executequery(sqlu);
/ S; G) q) @) b0 M%>
% \- z# Q4 m5 T* f, W) B7 N<script language='javascript'>8 B0 @: s% P1 t' D
arr = new array();+ e9 m. C( W, i
<% int temp=0;
4 \% |4 f. N* {) v0 q; g" C% }while(rs.next())0 S s4 G; r) }- c
{
6 y& i; D; s# O%>6 N+ d6 `* z3 }$ v6 x
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");( V9 S# ` ?8 G
<%
1 ~) F; N% ?2 F1 Ntemp = temp + 1;
1 S' U9 D5 v% A}+ h1 ~! n' k1 y. C% ^3 ?
%>' v' _( I$ F, e+ O! z
temp=<%=temp%>;, G7 f. n" H, `! u7 L' y" q
function changelocation(id){
* Z* L6 g* Q6 ]7 e& R) Jdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 ' b) S4 a) S; ]
var i = 0; " c9 v1 k4 M) }4 X
document.combo_box.city.options[0]=new option('-------','');
* a/ p/ p. e3 `& x* Vfor(i=0;i<temp;i++){ 4 K5 c7 h+ b. ]/ ]! W
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] 3 m; w: O0 R. s A1 f; i
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); - n3 _4 g( K0 y6 P7 I$ N, O8 ~4 y
}
9 ~4 G3 F6 G& ?) y( R' u} - j! l3 ]: X3 U* M9 D5 l$ T
}
1 L, \/ {# U' Z0 j1 M' @$ c, E& n</script>
1 X H8 n3 i( x3 @' c. E0 t4 |
: u) z, e+ R) E% ^$ q2 v<form name="combo_box">: o a/ m" j" {* A
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
6 D1 u/ { }8 d1 N, u <tr height="24">& m; k( V U! H0 H
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>- V6 L8 s6 [: e" S
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
" p y! a w2 {2 Y0 }) C# s- j1 t' [ <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
6 ~7 c& A' y- T9 u: L <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td># T3 B0 Q; o- [8 F
</tr>' c/ N$ G3 t0 a" Y2 N
<tr> * l* [* c+ Y% t
<td># q* I" _0 t0 ?5 d
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
6 S% m5 n7 i* D9 F# I <option value="0">请选择部门 ---></option>
T! K! U# T4 @3 G# r. V. q5 @<%
* m/ Q& h- I' w+ k string sqld="select * from tdept";9 @' e* K( a6 p x- E( g* g
stmt=conn.createstatement();
) u0 x1 A6 ~3 @' ?" p `2 wrs=stmt.executequery(sqld);6 `" r( H; }6 G) ]: m7 w
while(rs.next())
( \# K9 P7 e% H{
, g( ]. s0 i9 D* r1 A%>
0 m' H, R9 X. ]% e+ T+ y <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
2 i; P0 J" F) S2 X$ A k<%/ {7 A) H! r! D3 N; G5 e" f& b
}8 U, ]6 m/ Z8 F* g( G; C
%>
! d4 q0 b8 c1 s* _$ L* ~6 ^ </select>+ o. z4 S P0 @9 M( i) @4 o0 E
</td># i! o. |: x- B
<td>
8 ?4 d4 D5 R# P( }2 ]8 c6 S: C9 Y <select multiple id=city style="width:150;height:200" class="bgc">
+ ?3 m: t9 a; R( S/ d# D+ l( P </select>
9 A: h, o, Z2 }, z, E5 z" A" H</td>
/ h% F! R- I' T- Z: w, U <td nowrap align="center" class="bgc">
: E. e" E6 ?" \+ E% k7 \" e <input type="button" value="<<" class="buttons">0 N8 F8 k3 G/ O: h5 z( Y
<input type="button" value=">>" class="buttons">
1 D# m1 l0 r. j' O' c</td>
4 I% A; t" G$ H2 { <td>9 t+ `4 W& K7 N5 e
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
4 U9 L9 J+ `5 a4 z# e </select>: K" r* ?* ]' ?
</td>
6 `. a0 E" x! ^: t- C </tr>$ g# I5 J7 t+ ^
<tr class="bgc"> + @- B9 f/ S4 B& T( {8 g
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
( S# `$ Y/ H' l' z9 `( Q7 U </tr>0 W7 [" Z! `1 h* E7 M
</table>
3 p6 \( O( k' u2 q" P" j, W</form>
) I* h! c7 N* \7 | k9 O<script language="javascript">0 Q! q9 N& [; R& [$ q
//人名移动' ]. x& E- P- u
function move(fbox, tbox) {
6 q, {3 U/ r* v. l& u1 G lvar arrfbox = new array();3 J4 ^8 j: |0 ^% q* N
var arrtbox = new array();4 a. d# s. \1 _3 Z
var arrlookup = new array();
. k, _4 @" G6 X+ A, Dvar i;* u# c/ V, J( j6 @$ ?$ b$ n
for (i = 0; i < tbox.options.length; i++) {
6 J7 m: n$ @: P4 l, iarrlookup[tbox.options.text] = tbox.options.value;: H9 E4 c+ x. W: w# n; u
arrtbox = tbox.options.text;
& [+ m9 d3 F0 E* ^$ p, u/ d9 `+ e}
+ D" I+ \& u: {' n; Bvar flength = 0;( }5 E( c! X% \. s
var tlength = arrtbox.length;
* w9 a) K: m, _" d6 i4 ]1 Xfor(i = 0; i < fbox.options.length; i++) {
0 |8 _9 h! I/ p/ g' Zarrlookup[fbox.options.text] = fbox.options.value;
/ \. J$ x' j. ]' @if (fbox.options.selected && fbox.options.value != "") {& H9 m# ^. j( H& l4 x
arrtbox[tlength] = fbox.options.text;
/ I! _' Q- i& p% e& d* e" p6 Btlength++;
9 t$ Q9 e" b @: F}( B& X- R: B7 e9 f3 e9 m- R* ]% T
else {6 n1 c8 N& l! O# C) Z) e0 [
arrfbox[flength] = fbox.options.text;- q& D. V# o. @, v- r, M
flength++;* K4 v6 i! p+ [: s5 e/ ]
}
- x/ T( r) F0 B} B7 K( \+ Q+ z# ~; l
arrfbox.sort();/ j% z V9 j" n& U
arrtbox.sort();' D9 Z% H- W* S' z! m$ [
/ o F& D$ O2 V. s
fbox.length = 0;
% }) c8 J" ~9 f+ l* t$ [; ptbox.length = 0;
, @ F: M) }& N& y9 W4 }; }7 X9 [var c;; ]& Z& {9 c9 }6 w$ V* |1 |
for(c = 0; c < arrfbox.length; c++) {0 M9 ]! e0 s2 K( q
var no = new option();/ a1 P6 G5 p+ `! F1 [. W# m/ s3 N. S$ o
no.value = arrlookup[arrfbox[c]];0 A) A7 _9 Z6 ~& b+ D; q
no.text = arrfbox[c];, I! i1 l) a1 p. @) D" E
fbox[c] = no;
( y" g# b4 n% Z}, [9 _/ j2 W; ?. o C9 G! {4 D3 T Y
for(c = 0; c < arrtbox.length; c++) {! n# c4 i7 ]/ P2 u! r
var no = new option();
# N4 L+ M) |; ~3 X0 g0 p+ f9 xno.value = arrlookup[arrtbox[c]];
( Z1 t2 v G8 w1 L/ Bno.text = arrtbox[c];- T9 A9 v* S' k( h
tbox[c] = no;9 H2 i" A2 a3 W
}
, P [) D# W1 B, v$ K- @}$ \ F! f# p; a8 [7 G1 p
</script>
, h/ Q( w% \% B4 r3 ~2 Z3 F</body>* T7 k) w8 k8 X0 h
|
|