  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14161
- 金币
- 2371
- 威望
- 1647
- 贡献
- 1319
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"' W: M# s! }& L4 v
c pageencoding="gb2312"
0 s9 ]1 D7 x0 \$ q; C%>
8 {+ k( h) {# T+ c$ o8 O<style>
0 r5 n7 p2 s5 D. I3 T.f9{ font-size:9pt; }0 p6 C5 g8 S! l! ?! ?* w0 O0 h
.bgc{ background-color:#aecaf9; color: #0033ff }( p* m, [3 Y8 M
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;& z" w; d1 w' R. Y/ N
border-bottom: solid 1px #4e7dc1;0 V7 q# `- ~5 [( o6 W7 V: p r; e
border-left: solid 1px #aecaf9;
2 j- V& S( G& y8 l, |$ g1 p c border-right: solid 1px #5679bd;
. d- ^ M# c+ C: i6 o padding:1px; W& S. ~: i: t0 S! ~6 @
margin:0px;}
0 z; Z: {; a4 A: g</style>$ ]* ] @; B9 l0 {0 p# H) C( r
<script language="javascript">
% e$ d! c; h8 A<!-- G1 d# c+ A" N8 D. M
function rv()! a3 C, [+ r/ v8 y& d* z5 [
{' D% S w. U, U I' w- N: W" o2 s
var val="";
: e, F, W. K4 F2 J for(i=0;i<combo_box.list2.length;i++){; T% o+ g- C4 k+ Q' y$ U4 _
val+=","+combo_box.list2.value;
- e; l6 H+ n T a }
. Y* \/ {1 k. G4 I& } if(val.charat(0)==","){6 y& I/ W. w4 ?. V0 m( L
val=val.substr(1,val.length);
0 {, r( c' T" G/ z; J }
, ?6 w) N% S: k) `& Q opener.form1.frecname.value=val;
3 a2 B% S+ g, W( k: y) j# O! g self.close();
0 U0 t* S) _0 h$ S1 E}0 W7 i: T7 d, h) P
//-->
& T& \3 H* R/ `& f8 h f% Y$ F</script>
- s: b& I2 p' U) L6 a( p<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">6 ^6 V8 ]) O. \* e
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />1 S7 O) q5 m+ T% T2 K: N
<%# E# _+ {$ \" }
cdatasource ds=new cdatasource(); //数据联结bean实例1 u z C0 n/ T1 Y5 T4 d6 l# d
java.sql.connection conn=ds.getconnection();, ? d$ U4 I! q, l5 A+ I0 m. R. N. P
java.sql.statement stmt=null;7 n) ]" E/ y1 V7 e
java.sql.resultset rs=null;
1 Q3 H! E3 W8 u$ P4 O cdatacheck dc=new cdatacheck();" L5 e6 x( E2 P# {3 S h; U
%>, S9 C. B" Z" Z; M
<%# s5 [0 @& ~$ C+ U) [1 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";. k( _6 ^9 B: j* e$ M. _
stmt=conn.createstatement();; J" t, N; }/ Z1 k* u' A, T! u
rs=stmt.executequery(sqlu);; O# k) C/ k. r+ h4 X5 Q
%>
6 B( d9 i* \ Y1 y8 C, E9 `+ P<script language='javascript'>
6 e! K7 W' f& D5 h7 D6 Warr = new array();4 r6 Y7 i1 T$ Z' |- V( j8 o
<% int temp=0;' G: v) p/ K- L! Q7 ^% z
while(rs.next())0 V% f* m: g8 V7 E: h
{. S, `" h4 n0 Q( W+ X* b
%>5 D) S# M7 m6 i6 m
arr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
( b2 g' D" ?& Y* k<%
" Y; c0 Q0 R, {! I* [7 ctemp = temp + 1;
8 p* ^+ i, X& b' A0 q5 v$ i}$ m0 j: G& J: P: t$ d4 C3 x
%>' M0 l1 f( n6 z. Q' l' ^+ t, Z
temp=<%=temp%>;
3 E \* J8 ^% z) |function changelocation(id){
! c6 T2 t$ P7 r2 Jdocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 7 }" d: _/ g- {! v8 t5 c( o
var i = 0;
/ u9 |+ W# Z# Z" G3 Gdocument.combo_box.city.options[0]=new option('-------',''); 8 ?9 c+ O' k2 h! s$ y
for(i=0;i<temp;i++){
/ {- X2 z4 I) Q8 C9 z' p4 Eif(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
, e+ K$ I5 o, G/ v. V. o {document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
+ y2 @4 N. t. u}
) X! k% [! j2 i4 z} ( y0 z( |3 \* p- j' Q
} . W v4 A% B# D2 |7 r
</script>
; J' v8 v; M& z; }" ?9 O6 b0 V9 I8 L5 Z; [5 _7 |: M5 M
<form name="combo_box">+ w/ }& v: r# a R' r# P8 |$ J
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
" C" G$ \0 l5 O9 g! X6 P5 W) M <tr height="24"> a4 R0 r% ^& u. t" J
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
2 X" E& ?" J; r: x/ } <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>6 f0 W" d& W+ a% Z9 x
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>( M& `/ M6 R0 Y6 i
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>$ t3 u0 ^; A4 ?7 {
</tr>" y c1 z1 t! ^% E. }4 i
<tr>
8 I1 V6 @. ?( {; @ <td>5 @4 K$ B# d" S
<select multiple id=prov name="prov" style="width:150;height:200" class="bgc">) R: h1 X) ~2 Y* [7 o5 V" `0 i1 _
<option value="0">请选择部门 ---></option>+ @8 E: B+ ]( K' g' v, [
<%- w- C: \; n! l+ D0 Z7 S
string sqld="select * from tdept";6 @3 P% {9 t, f; m# m* j. r/ V2 J
stmt=conn.createstatement();
7 s6 \" g) \( _& {rs=stmt.executequery(sqld);2 E/ a2 u1 M% p" z" s, T
while(rs.next())
! C2 u% x" P, a; u+ b$ W. _6 R{
* U% [2 z" L8 T6 Z$ m- z+ h0 L%>
2 Y5 E$ N. q1 k5 ^+ s1 O0 V <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>7 q1 o: I! _0 _
<%
* @. }0 N4 {5 t}
% l3 s, i+ i3 e, c, ]# `%>
6 {; j0 f! E. A/ w5 z </select> v B3 S5 f5 c4 [9 M
</td>6 c' A- @( ]- D1 I4 `8 ~. H
<td>+ S6 t. a! |+ f. h
<select multiple id=city style="width:150;height:200" class="bgc">8 k- G: h/ T6 H5 K n" p1 u/ ~2 v
</select>
5 v4 r- S! ~/ ^4 P</td>% r* I4 a) N1 }
<td nowrap align="center" class="bgc">) q+ {! K& g/ }- P: i
<input type="button" value="<<" class="buttons">- u5 y& }3 s+ T" |/ i. y
<input type="button" value=">>" class="buttons">7 ]8 W" a& ^2 J9 `" p8 Q
</td>
j, [. }- x- t <td>8 O8 c! k3 N! H$ K7 B7 K
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
& M- J5 {& Z, ]/ @ </select>
2 F# j1 v2 g. R( k& }# F</td>
' K1 Q, \% h! M" k7 ^ </tr>. w1 h: ]5 n/ ^+ X
<tr class="bgc">
0 c3 C" K" N" I <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
, l; C$ h/ X% J. Y# c9 H- @" E </tr>; z1 @" @" x" S1 u4 Q3 B. G- |- c
</table>5 o( F3 Q0 C X. N* d
</form>/ M9 j' V% q% w! m2 i
<script language="javascript">* K3 S8 u# S" B8 |, d
//人名移动( {0 a6 [- O9 V1 c
function move(fbox, tbox) {
8 D N* N. n4 ]- J6 c/ }7 Tvar arrfbox = new array();" ?# U* ]+ |% @; `
var arrtbox = new array();2 \, H) e. I8 |: n$ A. m4 o1 r
var arrlookup = new array();% R/ _5 M7 _$ Z( g0 ^( D! J
var i;) {% I' A5 H" g9 u
for (i = 0; i < tbox.options.length; i++) {
+ a- p2 ?* C0 Y4 s! C4 carrlookup[tbox.options.text] = tbox.options.value;
( U# w' ?# `) b( @6 Rarrtbox = tbox.options.text;
$ p: K6 U. f5 W' D0 V1 ?. o}
0 [1 c( G, ?9 h# E# q* ^var flength = 0;( u" M/ v% i* m& q
var tlength = arrtbox.length;
' e! ]/ z8 d9 Xfor(i = 0; i < fbox.options.length; i++) {! u+ {8 z! m$ y' r2 i1 ]
arrlookup[fbox.options.text] = fbox.options.value;5 s; f5 M1 X* z$ l2 i
if (fbox.options.selected && fbox.options.value != "") {& [0 b9 k* q! g3 o' l" ?
arrtbox[tlength] = fbox.options.text;. X( M u6 d. f$ i+ W5 p
tlength++;# B: v4 F& c0 u' S2 }6 S
}
' n; G$ I, q0 welse {4 B; v' ^& j. w1 j4 o6 @6 Y6 ^; I
arrfbox[flength] = fbox.options.text;
8 w( q6 z* _ k- ]8 L1 k- ]flength++;+ j2 o& v* Z. n h3 J1 n, z
}: d& \: X: W; U P# Q/ x
}
+ l% c7 ^$ p/ O2 @9 |2 q) varrfbox.sort();; c+ x7 R; y6 \- I% y
arrtbox.sort();# m3 c0 k! q9 f5 k. G5 s6 T& x, A5 V( r
5 n* c) b5 [$ G: Afbox.length = 0;
; P2 K0 I& B* `9 l0 I* Itbox.length = 0;
1 R. q+ w. N. ]" r- u2 c. I- @2 U1 ]var c;, K, Y) {9 t' u5 d4 d6 o) |
for(c = 0; c < arrfbox.length; c++) {
+ r1 I. t1 Z5 E' }4 J- ~var no = new option();
& _- q$ E8 x- ]& F4 U6 gno.value = arrlookup[arrfbox[c]];9 f7 E( k9 r' a' K: f
no.text = arrfbox[c];
7 N8 ~1 l8 e" `3 i7 ~* t2 r8 G) tfbox[c] = no;
) @1 R, A L6 {' E' m! b4 P}
' C V0 E4 D$ D9 Y9 ufor(c = 0; c < arrtbox.length; c++) {
0 { K( C. f. E5 a6 {% svar no = new option();
: ?' U/ y1 Y" }7 z' mno.value = arrlookup[arrtbox[c]];9 Q8 o3 @, w& f* r
no.text = arrtbox[c];
* @6 N/ v. W' a4 _, f$ btbox[c] = no; P9 o% {* l1 {3 _- K
}1 E; }2 `9 {3 `- m. Q
}5 J$ Q$ N4 R' R9 z$ d
</script>5 [( k* n) y- Z# F" N( q r/ o, y! r
</body>
, R; Q7 R' [7 K6 h |
|