  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14247
- 金币
- 2414
- 威望
- 1647
- 贡献
- 1362
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
4 L, P" n$ K% J5 @9 b c pageencoding="gb2312"
0 J3 R9 x4 ?+ ?. p3 G* h%>' z( e( v1 C9 o0 n
<style>" T/ _5 K) p% G, x) S
.f9{ font-size:9pt; }# \! Z' z% s: }# m7 i8 x
.bgc{ background-color:#aecaf9; color: #0033ff }
1 I0 A `9 R' t' ?0 X.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;0 I+ R7 R3 J y
border-bottom: solid 1px #4e7dc1;
W0 x6 `8 V! K. f" C' x+ P: \ border-left: solid 1px #aecaf9;
2 u2 t# D& f$ M8 N border-right: solid 1px #5679bd;
! [8 w9 Y0 o$ w padding:1px;
1 |/ B/ k* p5 s( }1 K5 @ margin:0px;}( ~& |$ v5 \( J1 l* X, V
</style>
. c# N5 P2 ~) r<script language="javascript">
/ a6 [3 r9 f- p$ D<!--
1 v% q, C# H; C8 Z! ], Y$ vfunction rv()
3 H/ f, W5 o3 c" ]+ [) S2 O{
$ d7 g% q/ l1 b var val="";; W0 J5 [/ @3 [. O4 y
for(i=0;i<combo_box.list2.length;i++){
6 c* h+ Z" k1 p* N8 V( G/ a: ^ val+=","+combo_box.list2.value;
6 w9 ^( c+ x0 \7 o; Q9 h }9 V! L/ B$ ^5 p
if(val.charat(0)==","){
6 h, ]7 h z3 t. R3 b$ n0 b! L7 }( o val=val.substr(1,val.length);! d- W" a+ y4 w L5 c, w
}
1 Q" @) z1 A. C9 O7 A1 u9 l opener.form1.frecname.value=val;7 N- M" G9 T* t
self.close();
& [6 y# Y& |# t}
4 ^5 M. P& M6 g* q5 B1 ]( W//-->& ?2 w$ s% _; {
</script>; {. u5 Z" L/ r6 s# p/ R% o
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
' [2 N3 w& ^* x+ C* A$ T8 N" l% d: k& [<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />9 d& c( w, [5 O9 f+ X
<%0 i3 B! G R: P- q
cdatasource ds=new cdatasource(); //数据联结bean实例/ v0 y& Z# v1 _3 A( s
java.sql.connection conn=ds.getconnection();, s/ y, R/ o; p# V
java.sql.statement stmt=null;# Z! Z- K. q' j$ F8 j
java.sql.resultset rs=null;
8 t6 K1 w5 H- X, \% p6 P$ @ cdatacheck dc=new cdatacheck();
. { S4 S* ]. ~8 D2 w3 X%>
* |+ l6 S; P9 T# s<%4 C* X# |% |) z/ ]; V5 F) C
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";% l. Z3 F- G0 s' \; C
stmt=conn.createstatement();, h& s# H8 c) @9 `0 ^/ D
rs=stmt.executequery(sqlu);5 Z1 n- R/ c% U0 E/ _
%>
( ?. y( |5 |( i$ Y<script language='javascript'>* ?) B6 g. k& R1 J0 v2 k l
arr = new array();
" Q2 ~3 `- Q0 p<% int temp=0;
; S( f- \/ I, T/ U _while(rs.next())8 _4 N" `0 O! U7 g
{
O: S1 p `) p* Z: v; G3 I' Y* E1 J0 ]%>
4 J4 v. D' M2 j4 E; rarr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");6 C" G3 h1 }. L2 } T. a
<%
1 O3 [. |3 O) o2 `temp = temp + 1;' l4 i' Q0 A( V. m
}
6 J8 |7 k1 A; c/ I3 v9 r6 L D%>+ M# X9 C+ o' D+ C4 f
temp=<%=temp%>;+ {: Z! ?! _. [& x
function changelocation(id){ " ]5 R( f( T( k- E/ {
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 - l/ K3 G& U* J& S* I
var i = 0; $ ]1 O$ S0 b+ {. L$ t
document.combo_box.city.options[0]=new option('-------','');
* ^% V/ }5 \, q& R- cfor(i=0;i<temp;i++){
0 v: S/ n* ~7 K6 H0 }5 tif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
: T9 e. J8 n Z' ^$ p) tdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
% m1 A) D. d1 w' Z}
* r$ j" C5 {& l3 |+ J}
( j3 X O% Y X2 P2 o}
# m* w, R; I9 q</script>
- J# G9 s! g# c' ^9 X' R. q, y2 _
L5 `4 \3 G3 j0 \7 X<form name="combo_box">
2 T1 [3 V. g6 K$ |8 N6 w* ^, b<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">/ a# C/ T2 M% `7 G$ J
<tr height="24">
G1 n B% r) f, Q <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>! J' R9 ~2 k" o8 O' t2 Z8 S
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
7 t. P' K6 x: B* a# J <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
* {4 n7 U8 L! \4 R' |6 R1 X <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>- J. F4 r$ p% R9 `, I! G
</tr>7 n8 n+ d% e' r
<tr> : U) J) e& S, B; O- ^
<td>
, d4 |) I8 D- A* `! C2 \# r <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
) W8 \( n* j9 Q: G) O2 _( B9 e <option value="0">请选择部门 ---></option>
2 A0 e, i d, C& W<%5 `# a" ]; N( T" G
string sqld="select * from tdept";
& f$ y) M0 U* D" N& ~6 o0 rstmt=conn.createstatement();
/ V2 j! I2 S: |; O3 Prs=stmt.executequery(sqld);
; j$ y0 I) n0 Q4 k) l3 H3 mwhile(rs.next())* L/ z3 n$ @3 O" b) a% n3 ~2 b
{& P7 ]' }+ N3 q! D0 G2 s4 \1 O& M9 L
%>
& G2 D& ]" |3 ?, A' ^$ v <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>. D% C2 s4 I% [- r2 i
<%
$ ]* J3 I! T: ~) F}/ V$ w& s( P1 T. \2 A* ~
%>
8 q; Z$ m. Z7 |; W1 X6 k </select>; |% ]. O, k, i8 W' d
</td>
# V: z/ l J; y* l8 Y <td>! p0 b- X5 D L( B" m3 ^7 l
<select multiple id=city style="width:150;height:200" class="bgc">
8 v" p( V% b' Y; i$ F </select>+ ? }; C7 p( {0 l
</td>
% c' B- K+ b9 w5 `8 D( H <td nowrap align="center" class="bgc">
: `2 E$ v% O5 T. X) R5 F8 @) G <input type="button" value="<<" class="buttons">' o* \. d' W2 Y7 ~
<input type="button" value=">>" class="buttons">: W: B% C w" C0 q
</td>$ U& L9 ^" ?0 }+ D
<td>
, \% S9 a% n* v7 ~% F/ w% B <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
5 G' k0 D5 i% _/ t4 Y </select>/ y. X+ [) X9 V, D; J b
</td>) `8 ?1 Z a1 H6 r& g% r
</tr>
: S4 V3 |. C0 x Q <tr class="bgc"> 6 ^; j; s- ?+ H6 a9 K$ X
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td> `& R9 y2 N, _0 M% A9 C
</tr>
0 z* _3 S( c6 A; [' f</table>+ D8 @9 @5 ]( t" D% B/ a
</form>
+ z8 M T, y0 d0 b X; |; }( L) }<script language="javascript">
- Q2 K' s$ b7 o$ o//人名移动
" l; s5 e) b7 U; }2 h3 e0 H* Pfunction move(fbox, tbox) {
Z! R' W. k$ w& B+ N: wvar arrfbox = new array();
5 |, {# Z ^# @ `- G# Ovar arrtbox = new array();
2 \: a( x! W/ Yvar arrlookup = new array();
1 n. D% Z" l8 m/ D/ D& |' d- v2 Lvar i;3 X3 P4 i! ?; [; n# Z
for (i = 0; i < tbox.options.length; i++) {
* E; f' \ i$ Earrlookup[tbox.options.text] = tbox.options.value;, Y2 s+ e# L& a( T; n
arrtbox = tbox.options.text;7 |$ h+ e6 \' N' B2 k1 C% r ]
}
0 R4 u( v- Z- [2 V5 s5 O4 `var flength = 0;7 H6 A" a( d- y& e6 J
var tlength = arrtbox.length;
o0 }' a6 v) t( Xfor(i = 0; i < fbox.options.length; i++) {
9 e5 F" d- x$ Yarrlookup[fbox.options.text] = fbox.options.value;6 c1 A$ e2 o$ z7 g2 G/ o
if (fbox.options.selected && fbox.options.value != "") {
/ K/ c2 g+ C$ a2 t6 A) u: Warrtbox[tlength] = fbox.options.text;3 L6 E( T' u; K3 m% a* M- a
tlength++;
; t/ ]9 {" S9 ] s" a' l}
! R* T$ a8 [+ telse {( y# f" Z2 ~" X; v% u# b$ `; Y
arrfbox[flength] = fbox.options.text;' u! G) l6 c" J2 x7 I6 b5 A
flength++;
# g- ^+ M5 u" ]9 D( r& O }
% Y) f. n) S2 w" r+ C8 [}! W: D8 r# l- L- w* n& G
arrfbox.sort();
# _; l7 J% {' C& |/ f5 Darrtbox.sort();
4 v" m1 |; p/ l+ K8 M: g( [. X8 W
fbox.length = 0;
, Q4 }3 Z! O" u1 P% f( _: qtbox.length = 0;* U7 |. Y/ N/ u+ D# y
var c;
& O0 I3 Q" { G& n- lfor(c = 0; c < arrfbox.length; c++) {
6 N E' w5 i0 i- ]8 wvar no = new option();! x, ^( z1 i, _0 W5 }
no.value = arrlookup[arrfbox[c]];( [* H' Q8 q4 H$ \
no.text = arrfbox[c];! V% M( O0 D. L- B+ t
fbox[c] = no;
6 J( L" c8 P/ U' W}
6 |# R2 b8 W5 E) pfor(c = 0; c < arrtbox.length; c++) {
2 \% L/ \5 e# c. gvar no = new option();- W6 G" W# @! a# H+ X
no.value = arrlookup[arrtbox[c]];# h) ~: L/ J( V" j# V4 }
no.text = arrtbox[c];: H6 n) D0 y) K& g8 ]1 q) u* j
tbox[c] = no;
$ Z4 N7 \& A; n9 ~9 @: Q }$ J4 n# z7 h) Y
}
! {! W% z% q& ]% M$ a2 q</script>; B' {7 Z% w& W
</body>, X; _/ }( Y: h7 }4 A9 a
|
|