|
  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14383
- 金币
- 2477
- 威望
- 1647
- 贡献
- 1425
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"7 N3 R" ?8 K. E9 R+ J% e7 Z/ g
c pageencoding="gb2312"
: W( r9 @. O- I%>
$ x" v, S6 Q& ^- a6 P<style>; T% o1 c) Y& h4 k8 X9 m
.f9{ font-size:9pt; }+ i! _: x" D3 Q; D9 w A: U
.bgc{ background-color:#aecaf9; color: #0033ff }* h4 J! y: Y% L) g1 T+ V) E( C
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
. V& z- K- @3 N! H2 k border-bottom: solid 1px #4e7dc1;
3 ^& G0 w1 R8 d5 ], h* {+ _& D border-left: solid 1px #aecaf9;' Z- _" {% r9 P9 b# ]* w
border-right: solid 1px #5679bd;
' E: g o% g* Z0 W9 e4 j' | padding:1px;( ?) o) Y0 g* z+ F* r1 K, Y
margin:0px;}& ^" e9 l8 y+ [. a9 ]& g
</style>: C" t9 ]8 G6 X" R. a1 y5 H
<script language="javascript">' |9 D" \# n5 w' j$ Z4 D; u: M
<!--
: m; K1 }# g$ c: ~7 o! tfunction rv()" N1 _# p4 G% b/ m o3 E. X }
{
# v* @% q9 ?! ~1 [8 c) | var val="";7 g8 ]' [. h- ?7 g' V( u. ?4 A
for(i=0;i<combo_box.list2.length;i++){
- z% r& o( {: q" h) q val+=","+combo_box.list2.value;
8 r# a" B6 N( n" ^$ Q- }5 C }
1 V1 a# X4 F0 L4 r W3 C if(val.charat(0)==","){
+ j9 f0 Z" {* t" B val=val.substr(1,val.length);
7 k4 l! \$ ^* w }
3 r6 w7 c' ~2 K' N& Q, g0 Y opener.form1.frecname.value=val;
, o6 F; a$ `/ }9 e9 w* p6 ? self.close();
+ ?/ z0 W, z% [5 _4 r}8 T4 Z6 P' J- Z4 E) X
//-->
7 n: [9 i3 Y6 M& z3 Q( w</script>
6 t! k- U6 i$ `" z2 J! p$ ?<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
: |8 d. o- l* n0 G3 ?<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
1 j! ]1 ^/ g) l/ a( g, I+ D9 g<%- ^) d' u }' {- T8 z$ B
cdatasource ds=new cdatasource(); //数据联结bean实例
# u3 ]( }9 ~" y java.sql.connection conn=ds.getconnection();
9 M u: H: S8 [) E" n% t java.sql.statement stmt=null;' \2 U2 F; q0 A7 n i
java.sql.resultset rs=null;9 b4 s/ ?: t3 E0 Q
cdatacheck dc=new cdatacheck();
2 h7 R0 i2 w# L, d%>) q! R) a' O9 E# V2 L: o5 C
<%
3 H6 d4 j6 ?, p Mstring 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";
# S9 r9 O- _: C! R' O+ x% vstmt=conn.createstatement();
4 T+ v1 }: S1 Z0 V( k4 qrs=stmt.executequery(sqlu);$ Z2 E+ Q7 E' z3 o0 m' b
%>
$ e, y! S: B6 D+ v3 E<script language='javascript'>
8 j$ j% Y8 R4 y2 ?* V0 Warr = new array();) P! [/ @2 X" F3 s: d1 T* j7 O
<% int temp=0;& \# ~5 q% p; v
while(rs.next())
4 O- U) b5 z: {& l{
* S5 a/ a- r# Z* T$ s3 c" v! I%>$ j/ D4 w. y- P6 d! Z8 C, D8 m) r
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");3 d: s/ E" b1 {" Q
<%
$ v# z' }/ j, E- X5 {0 otemp = temp + 1;
* O+ @) H( D b3 h}
# c: X5 C) q& }! i) G1 n%>! @, @1 R! m% Q; r( s
temp=<%=temp%>;
1 M! W, F: S# |7 vfunction changelocation(id){
0 X" h+ H, v5 ]document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 , }! a3 e8 a( E; F
var i = 0;
/ l( d4 d/ B- |( ]# N% S0 ]document.combo_box.city.options[0]=new option('-------',''); 8 j. U# ^ w" b- C7 W) n) y! o+ B' [
for(i=0;i<temp;i++){
* Z/ c) o' g" V- L- N/ ~# } ]if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
5 R, Y4 A: a- H3 U/ ~document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
& K! y. p8 b5 Z6 g; j3 ~/ M$ V& b}
, Y* z! m8 @# @9 X}
; ~: [, W0 t) L1 J, Z" K ?}
0 {7 W* W! p( s: U</script>
1 d6 z: I& A8 ]" k2 x- w' e% M) o p
<form name="combo_box">9 o8 j) `! Y: v
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">% L5 ?3 M5 E- i5 \. H% j6 ^
<tr height="24">: y! D' L t2 A( Z: c
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
' ~2 e2 i7 Y( d' b0 H5 X+ B* ~ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>- ] [, e6 o$ Y% F) U
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
0 K( Q: ~. n2 o0 r& _ <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>, |& J- I e: _: B
</tr>
2 B5 e2 z8 E! `* t- f& w <tr>
' Q& z0 {3 `! v <td>% Z' }6 R( q" L1 s$ V6 Z, M# n5 _
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">8 ]& P4 r- `- y! f# R
<option value="0">请选择部门 ---></option>
0 D$ @: P) S, {. s0 @: P) p* W& w* G! ~<%
" e) M& a9 {2 l, x1 ? string sqld="select * from tdept";
( y- p$ f. |) @* ]/ Cstmt=conn.createstatement();9 q4 ]# @9 T, M( ~" u R3 V& i& u
rs=stmt.executequery(sqld);3 J( I! S( k. ?# P; s! H
while(rs.next())
) U! \0 \4 i ^2 x% q{+ S6 N4 ~- L' W, P
%>: v1 \1 f, D/ u* M0 z4 c B
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>
* C# ^8 b* x. e4 Z: @) j! }5 X<%
( O' b/ c) V3 D! ~}2 z1 g c" g: K4 ]7 q
%> 4 h) C$ q0 E, y3 W# A
</select>& J" w# x& S) [3 I# o0 C
</td>4 C3 k i# N! H1 V/ `
<td>
8 K! F# g$ b* f# g$ c1 d <select multiple id=city style="width:150;height:200" class="bgc">: ?9 j( |# @) _8 k
</select>
: T2 e4 G8 V J5 Z! a3 |</td>
3 ?+ @4 p6 |% E/ E* U" O8 C <td nowrap align="center" class="bgc">
' Z. V f+ ?# m) |$ _) g: o <input type="button" value="<<" class="buttons">2 y4 a* G. J; e/ _" [1 g4 h8 t
<input type="button" value=">>" class="buttons">$ L. I7 d( s. n/ K
</td>
) _. h( F' Q# \& h8 k <td>
% ?1 w2 z8 A- s, R1 T <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">7 F+ e% L( h& {+ ? \ W
</select>
* |( e7 c. n' }% R</td>
7 c I9 S7 K7 c, K y+ z </tr>8 ~5 w8 v7 W& ^; K
<tr class="bgc">
( ?& W" M# G* o <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
/ ~# e4 Q$ A$ b5 h0 v3 z </tr>! z9 S0 G3 k ^. Z# d/ k( C
</table>
* A6 \+ F0 f* t% `! b</form>
+ ~: ]0 T! z |8 I2 a( P7 v<script language="javascript">
: x7 a5 m- d, W# ~- U+ s//人名移动8 w+ m0 j- U! Q5 n8 o+ M
function move(fbox, tbox) {
% ?) C# V. G6 v. jvar arrfbox = new array();& {* u6 b) J8 e# z/ F4 g
var arrtbox = new array();5 g; h! v. e& @
var arrlookup = new array();% i1 n( t( p5 Q( M* ^, U
var i;
4 P- K, Y0 _+ z" B1 D2 H8 \8 Pfor (i = 0; i < tbox.options.length; i++) {
, E/ P# D& r- l& s) c/ r9 parrlookup[tbox.options.text] = tbox.options.value;
4 e- y' y3 B- j. K5 N4 A) M4 tarrtbox = tbox.options.text;8 q- ]5 Z2 S. x+ ?7 _
}0 y7 f; E, [5 Z+ d3 V1 u. {
var flength = 0;
2 @3 I$ O9 _5 _var tlength = arrtbox.length;6 p9 _8 K/ X6 F5 R- x k Z. m
for(i = 0; i < fbox.options.length; i++) { X3 o7 Q$ D r0 B; C
arrlookup[fbox.options.text] = fbox.options.value;* d8 }5 z8 ?& Q6 }, e
if (fbox.options.selected && fbox.options.value != "") { h1 U" y, L$ D6 S) L* j$ ]
arrtbox[tlength] = fbox.options.text;6 f* z9 U ^+ }) i* ?* J" E
tlength++; O$ K6 t7 ]5 S3 ~4 R" a, W
}
2 Z5 a* Y* o. pelse {
: m% K/ O" ~1 E/ ]arrfbox[flength] = fbox.options.text;
0 }6 L0 U0 v/ i2 T( r8 i0 }flength++;8 v) f: C' N" ^' ?" R" P5 r
}, v. y1 o( {2 H) V; |% P3 g
}4 s$ K% f7 ^/ S0 ~3 \
arrfbox.sort();
+ Y( q# @! y- M' s" Rarrtbox.sort();- Z4 Y G6 X, G: C0 {
5 `* T1 f1 y) Z* z
fbox.length = 0;
: g! \3 e0 [' m: g8 T7 ]tbox.length = 0;) c) L5 J# V" P$ {: `
var c;3 d2 X% r# `2 a8 n, }
for(c = 0; c < arrfbox.length; c++) {
- \) l# S. u+ H& hvar no = new option();1 b; C8 E O. K* l
no.value = arrlookup[arrfbox[c]];, I" ^1 ?3 I! b$ |6 I$ e T) p R
no.text = arrfbox[c];
5 g& X( [, V4 e9 O+ S( B4 E* G! Nfbox[c] = no;
. K, s, p% N- b0 Q7 }8 }}
- y$ k$ H2 {; w. Sfor(c = 0; c < arrtbox.length; c++) {
}- s# }6 {- B% A; u! Nvar no = new option();1 q3 m4 u- L% K* a; J
no.value = arrlookup[arrtbox[c]];
* {# n) e& ]/ @0 ^, [8 B$ a! nno.text = arrtbox[c];+ k) [- `7 A" t
tbox[c] = no;7 K" {2 H, a# m7 F) V* U
}, F: L: d: A2 y8 l
}1 Z8 I3 m3 U; m8 K
</script>8 T5 Y7 m5 a; E% D- P9 A
</body>( g" O* q- I5 A' V M* Z, D
|
|