  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14195
- 金币
- 2388
- 威望
- 1647
- 贡献
- 1336
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"0 d8 C) s0 t7 z0 t- T
c pageencoding="gb2312"
7 r! U$ k7 s+ Q3 C3 C%>+ c) `, ?; `- \) S3 Z
<style>8 p B/ L. L! V' R4 y" I4 k, T" W
.f9{ font-size:9pt; }1 k5 l5 d# t% l; }2 M1 P
.bgc{ background-color:#aecaf9; color: #0033ff }
1 c" W: ?% t9 u% K# A.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;. g1 b5 f) u$ e3 ^. \# i
border-bottom: solid 1px #4e7dc1;
p/ m' u3 J# U3 Q% D# U& W: s border-left: solid 1px #aecaf9;
. k) \. E9 j% N D/ D. S border-right: solid 1px #5679bd;
. e: [+ l3 O+ ^ padding:1px;
( U e$ S8 C$ g4 R: C% v! Y6 M margin:0px;}# W9 L. I' C" L+ {/ k8 j5 q
</style>
4 l! V* J' }$ n<script language="javascript">/ A: Y- ]" [- b; n! x( U% s2 c
<!--
9 S, ^1 c* B" {2 N9 s' {7 ]function rv()% `' Y1 o$ @- c3 y5 p1 v
{* {1 H) ^( Q1 N: b! ~1 P6 H
var val="";1 {$ K! j: z, G# X, N8 A5 b) w
for(i=0;i<combo_box.list2.length;i++){
/ ], ?& S: U8 Z5 o' f% D val+=","+combo_box.list2.value;
* S9 {4 R. P1 K' X/ j& r0 g7 Q }
7 ?" b# _5 h J, }# A, F ?, V7 C if(val.charat(0)==","){
+ b/ K* h+ h5 X6 q val=val.substr(1,val.length);* P. L3 j$ N6 ~
}8 T4 F8 ]+ ~ X/ ~/ U8 e& v7 W
opener.form1.frecname.value=val;, z! t% k) A E
self.close();
& ^% z( P% k* C; f0 V/ r}
" l' v+ l& G# e- y//-->
. _. N) _2 `6 J3 h: j# V</script>. Z4 g' }/ |7 r1 F
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">& ]; Q! T4 l2 P4 g- Q
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
/ Q# I( E: ]3 U* o1 K2 `8 S/ w<%
m, a/ b) r$ W8 C cdatasource ds=new cdatasource(); //数据联结bean实例
% W. t; I/ F2 T java.sql.connection conn=ds.getconnection();
( A# }& m& [' |! D; s2 {( V8 |4 ] java.sql.statement stmt=null;- ] T/ h4 X& J+ R4 r4 T9 G
java.sql.resultset rs=null;
$ X9 u0 S% G- q, Q+ z% S cdatacheck dc=new cdatacheck();
* L: M/ [; V7 {- W%>( y' H/ q- u) t. D) e# _
<%
' h9 d+ q8 ` Qstring 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";
! l2 S* O ^) s! Tstmt=conn.createstatement();! R1 S6 ]; g) l8 {
rs=stmt.executequery(sqlu);: E$ t! {" k. J* @1 J ^1 C
%>
( r: z! ]$ B# H+ H R& h3 q<script language='javascript'>, O0 }4 S& c9 s
arr = new array();3 h& s/ I( F2 H6 x
<% int temp=0;: r# x8 D8 b/ F- n# D% B
while(rs.next())1 X8 E U* q# d' G7 Y+ m
{
0 u0 C, W6 T7 o: l9 ]%>
* S. w1 \* r$ |arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");6 L8 }1 y7 _; `! Q0 |
<%& m% w4 t8 ^: E1 s$ s% h* |
temp = temp + 1;- g+ g0 K! O, X7 Q2 g" ^
}
' C% e/ Y4 h# }2 H' x% g6 m# w%>
6 D- M8 C9 Q: h C( |1 D4 i' }temp=<%=temp%>;
# i5 P! u! A/ F5 X' p: q8 x% vfunction changelocation(id){ & Y4 c& h p- g; a9 p& L& E$ x
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
* f5 T9 y* ~. v" k4 kvar i = 0; 1 { R& w" r. r# w; ~: i
document.combo_box.city.options[0]=new option('-------',''); ; H* r1 F' m& |; [
for(i=0;i<temp;i++){ - H# g! M% P/ Q2 @9 l; C8 c
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
# p7 }1 }0 }* M" N% @+ y3 y; idocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]); 6 P/ `' e8 T# X" E. P( r8 J
}
4 ^0 o/ q6 C9 M( F}
* @6 ?# W) S- y8 Y; q}
% W; i- ~$ s& Y/ q" f1 y3 o</script>! L% e7 W" x2 J$ S
% {& S& v4 v+ a2 M% v i/ Q
<form name="combo_box">9 j& {9 W" y+ L( o$ O9 W* ^, a3 [6 y
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">; h: I& ?; [ R$ |1 Q* h1 o
<tr height="24">
+ W' z0 l4 Y+ s) ` <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
8 A. Y( {: {' v6 H <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
% Z7 ]: l( N. C0 M u X <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>6 ~8 c0 H8 H/ Q1 \
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>, g" w: w) u. \) y6 a' c
</tr>, h. v9 l X1 B% q
<tr>
/ |! z/ C& X- t6 L: I9 B <td>
A$ n* G9 @$ F6 k* l <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
& u1 c7 r9 Y* P8 R# @# g <option value="0">请选择部门 ---></option>* ]+ j2 b2 b/ l$ A
<%
4 r! N6 y- M4 ? W8 ~& n( W string sqld="select * from tdept";
" t h3 v6 T! \4 q' w7 ?1 Pstmt=conn.createstatement();# T0 K7 w1 {, y c$ \, ^7 L8 E/ G4 ]
rs=stmt.executequery(sqld);. n1 Q$ C& L/ M& ^6 i/ N
while(rs.next())- q/ P* T! V# \6 K! P
{
% k/ i' U' {; }& B9 l%>
, P& W+ O) Z* ] <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>9 ]9 q) J% i3 d
<%+ ~/ e* ]/ R: t n' {$ O, [4 K
}3 W( Z4 c, m5 y) b
%>
/ d! g0 W3 _( w* q! p8 q </select>1 l, O0 F1 N$ h$ H" n8 e: |
</td>
; T4 Y9 `1 k% d7 A <td>
V$ p# m8 {9 b. \5 ]# f. V, z <select multiple id=city style="width:150;height:200" class="bgc">
& P% h6 C9 F9 m) I9 W% |. Y' m </select>7 G; U8 E# c4 k& V7 a/ s0 ]
</td>& ^& \6 o* t) W+ J
<td nowrap align="center" class="bgc">
5 y: |2 K, t9 ^- E: c <input type="button" value="<<" class="buttons">
: l7 q N( \" [7 `, f, h* l7 N; Z <input type="button" value=">>" class="buttons">, y4 f$ W) D7 ?/ M
</td>" I% R% n1 K, _* Q# H# h
<td>' r# ~( H- Y* \! @- J, b- a! x" z
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">/ n; Y: k K+ G3 @
</select>/ K8 \ `2 R1 X. G. `4 c! G9 j
</td>
4 `! j7 n, R& w8 r </tr>
w T- m9 g. ~/ e( l6 A <tr class="bgc">
. o$ l- [6 B- |4 j <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td> p5 V* X% I4 j& k
</tr>
( x, Y2 v! f) ~* s</table>
: U A, I/ Y4 t) F</form>/ {! u1 X% u4 s+ Q1 G; D
<script language="javascript">
4 u# S. N* a$ j- |- z3 ~( C//人名移动
D) L# c2 S! O/ Z. yfunction move(fbox, tbox) {7 i5 J3 `3 D/ Z# n# Y0 D- r
var arrfbox = new array();; e& H5 T; A0 c! K! X+ g* }0 K
var arrtbox = new array();
' X- D/ q N5 }var arrlookup = new array(); D/ c7 ?: ?% e' Q4 Y/ U
var i;9 l3 m/ [0 A( C! b, i8 M) p- w0 Z* N
for (i = 0; i < tbox.options.length; i++) {
' z+ x% t. [; H( f% h W0 ~. Iarrlookup[tbox.options.text] = tbox.options.value;( R( N/ K" t4 k; ~
arrtbox = tbox.options.text;
: S$ l% }* W7 n1 k8 T( q}
! `9 h! q0 L4 H" ^7 ~$ dvar flength = 0;& c8 D" D/ |6 Z7 E- g# a& A2 j
var tlength = arrtbox.length;
+ t1 F: \/ c a& t6 d* I9 Xfor(i = 0; i < fbox.options.length; i++) {
7 S$ C$ W5 x4 X, x m5 [arrlookup[fbox.options.text] = fbox.options.value;- G6 j" ?. s- a1 {
if (fbox.options.selected && fbox.options.value != "") {/ i2 ]9 x0 k1 n: N+ h% m2 D
arrtbox[tlength] = fbox.options.text;
1 j- f# C/ k& ]+ H8 }! p& Ytlength++;
6 U/ ]$ K: M; P% k6 N Y+ T}3 R, c( R% O. B; _2 T
else {
0 O7 n2 p3 @1 a, \# Larrfbox[flength] = fbox.options.text;
' l) L" X. p2 I/ _) h, Tflength++;7 o: l: A5 T% {( J$ l6 z
}6 M# G" f, C+ ]6 W( X {
}
; C) f$ K: {2 x X1 j# [arrfbox.sort();
. M8 L7 P; b6 [4 S. @* q: t: Harrtbox.sort();
- H5 b' V4 x! b. Y/ x* D# Q
8 p; ^$ h6 Z2 k4 Pfbox.length = 0;9 W( R+ y4 u. ~4 E
tbox.length = 0;. s( {6 Z. k; |8 ~; _5 G D
var c;
+ g1 N* X, m- r" Y) P, P/ {8 Ofor(c = 0; c < arrfbox.length; c++) {
- p# V5 e9 b% t hvar no = new option();9 A* W- Q/ ?* u, J
no.value = arrlookup[arrfbox[c]];
) K9 j- \. ~- z/ @' I: `; R, W4 ~. ano.text = arrfbox[c];
8 B" K" T: ?3 w5 I/ v, [fbox[c] = no;
+ y/ |; a' G- Y}
8 c% H; ?& }* ^; l+ mfor(c = 0; c < arrtbox.length; c++) {" r: [+ E0 S* s$ j
var no = new option();
; ?: J p# k$ Z/ Wno.value = arrlookup[arrtbox[c]];! ?3 A. k4 }2 W$ T8 ]- X
no.text = arrtbox[c];0 n# b3 G" Y1 {6 H& I- E, w. b
tbox[c] = no;" i! b# ^& M. b0 |! |
} W; s8 U- Y8 i9 T
}
! }3 O4 b7 w2 Q- r9 o' W</script>* l# o" [' z% |) f# {7 T
</body>( w9 Y, z. b9 }# T' W$ r$ @
|
|