  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14153
- 金币
- 2367
- 威望
- 1647
- 贡献
- 1315
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"
, X5 R0 _, @4 |% H c pageencoding="gb2312" m& \4 n9 z' S+ Y6 r' I1 q
%>* m, N" ] f; o; A5 ~& n! Q" Z- x
<style>, L" Y- J: w+ o/ v' Z1 j
.f9{ font-size:9pt; }3 S5 ~$ c* a- @7 ?( G
.bgc{ background-color:#aecaf9; color: #0033ff }
2 m- I, \+ F% P0 W- ~.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;5 F$ k' M1 h& `6 F) X/ B
border-bottom: solid 1px #4e7dc1;6 h7 {3 s o0 O3 M9 l$ g; T
border-left: solid 1px #aecaf9;
/ X2 ]+ Y, z3 t( _6 z0 C" @( l border-right: solid 1px #5679bd;8 R+ }1 Z/ u2 Y C8 d1 [
padding:1px;3 E* d5 R; [ y9 n$ v
margin:0px;}4 j0 _- G3 v [( \- P
</style>- p) Q) [* K$ o& ]. @9 ^
<script language="javascript">' |$ f3 l5 q" d0 m* Z
<!--. R0 e- w0 n; T$ U1 T" F
function rv()
/ @9 O8 l8 A* g2 G, H{$ r' s- X0 i3 t+ M S1 ]
var val="";
- P9 T; R' l9 @) S# z8 X* | for(i=0;i<combo_box.list2.length;i++){- \" l b- O$ ?% V9 d
val+=","+combo_box.list2.value;
- Z! V) Q0 X- V }
2 T: ?: v3 U$ k( S) S, c if(val.charat(0)==","){
. v5 t. q9 K' L5 i val=val.substr(1,val.length);0 i. o b8 F3 d `
}
+ I) [* o7 a5 o o. n opener.form1.frecname.value=val;
( @; z7 y1 o; Z1 D1 L6 U7 u self.close();
' u5 R, o( C# T& j( S2 w8 O2 _}
& g; _, g8 f8 C- k, j//-->
; |9 {: o4 E: G; s</script>
& V/ S; y, F+ b i9 n<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
. O3 h' S5 ~# J" L. h" v<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
$ j2 G" r; h& w9 k" q* M4 Q<%% R' N& P7 v6 g0 b
cdatasource ds=new cdatasource(); //数据联结bean实例# Y, R. b$ X* e
java.sql.connection conn=ds.getconnection();
. Q( k. i& M" W: N! x* X/ H- O java.sql.statement stmt=null;
( W: W" R; j; p+ Z3 i java.sql.resultset rs=null;- W, P" x G: L* Y0 s6 e5 _
cdatacheck dc=new cdatacheck();
3 s7 ]' l+ W0 w) h6 d6 O8 a p%>1 F W, Y" B& s/ V5 f' U
<%
8 L2 `! N) n' ~5 pstring 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";
4 s d8 Z1 s" S7 d, E, h! t, Kstmt=conn.createstatement();$ i) p) [8 k- j5 t# ^
rs=stmt.executequery(sqlu);( X; |2 f* `. ~& U
%>( {0 M$ P9 `- @( Z
<script language='javascript'>
7 K' e; t5 Y) ]8 z ]$ h4 {arr = new array();
2 R2 }4 P/ ~1 h: g<% int temp=0;
. t5 x, K" F, V- H0 ewhile(rs.next())
( w" y o% K7 s- x8 b0 q{
& j* o* c- y) Q8 C3 y%>
( i) F# a8 F4 tarr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
# `. f: P! h: M1 k1 r; _: W# R# {<%2 J. ?( Z4 I, ^1 { u5 f
temp = temp + 1;" z+ a% {' C. v! b
}
6 F5 w8 P/ A) e$ p%>. j6 v8 l) L! m5 W8 G- a+ s
temp=<%=temp%>;0 \. c$ n, U( v6 W
function changelocation(id){
C& F& G D( M a s2 l1 edocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
+ E2 y! v4 r* O5 Q& `9 yvar i = 0; ' y, C& v- l9 u% [4 G( U" X
document.combo_box.city.options[0]=new option('-------','');
2 \/ p( W+ r$ s# y: A( Ifor(i=0;i<temp;i++){ . e- Y& n3 L7 M- P
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
1 }5 r6 d& R9 i2 d1 |8 O; e6 Wdocument.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
; ~$ F, t% d, w L \" W5 x5 y} 0 s' l# ^. P( @+ i. i7 G ~1 x
} u- o8 L% X- B. F1 A, p& H& I! D
}
3 f/ o$ e5 X, _: g</script>
& a$ q1 _- ^; c8 ]+ i0 p" r4 l# u4 h2 E& a6 O( u1 {
<form name="combo_box">
& [ _' B6 c7 M<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
' F* ~6 D+ V) Z7 v) I <tr height="24">
" D: O: M( d: `: X5 a+ [: f$ R <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>- d1 l; o. A- M" j2 t
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>8 }' A+ J3 E R/ W- [
<td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>
2 M; z% b- X# ]1 ?/ ?% p$ J$ H <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
3 t& m. e5 m/ @$ ^. ~& t+ N </tr>7 w; L) e- D+ ^, b
<tr>
) M8 l' x- I5 s5 Y <td>
- @ B8 i; | \" T7 @ <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">8 @/ k. [3 n5 w8 L$ Q
<option value="0">请选择部门 ---></option> ~/ h( }; L% C# h; {
<%. A& {4 k7 H9 f" J3 c! d; k Q$ V
string sqld="select * from tdept";- y# g* b3 N3 H8 E# v7 u( X3 @1 P
stmt=conn.createstatement();% q: u( }9 I6 A7 `# U l
rs=stmt.executequery(sqld);# [) k* O6 ~0 _4 E
while(rs.next())$ b9 J @& s2 a5 X2 |1 U# ^# t
{! M4 W3 Q0 M# _" H- c2 B! U
%>( G( F/ q3 J' M, f5 @
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>+ k2 k. u; a: x$ A2 ?' e
<%
" V1 z; G$ o" ]! U# X}" x! h7 z# f# t9 A6 w8 \, L: k$ }8 D
%> ( P: b4 }0 M4 j8 ~2 A
</select>0 L& p9 R: A% L* `
</td>
" I$ @0 p! r5 \ <td>
4 l- W3 L9 z8 u) M <select multiple id=city style="width:150;height:200" class="bgc">
2 S9 p& J! r- B. m </select>2 V2 g0 \ D; z2 _+ ` L/ W
</td>5 ]; ?' z1 `, F( w2 A3 Z
<td nowrap align="center" class="bgc">
6 C/ C6 n1 f9 H, O/ K" Z <input type="button" value="<<" class="buttons"># G3 v9 |8 x8 I* c5 ]
<input type="button" value=">>" class="buttons">. ]3 b: J( f: z3 f( k/ I, Q, d
</td>
3 |1 |& D! Y, b$ W1 f <td># b. ^- {( ]( Q8 ~
<select multiple size="10" name="list2" style="width:150;height:200" class="bgc">
$ j" K4 h9 ~1 }8 _2 F </select>
* P& [0 x+ Z& k# h</td> z! E1 w6 W8 x% I7 B& P
</tr>/ |9 U: _# [0 u. m! D0 N3 g7 u2 u
<tr class="bgc"> # {1 X# r, H$ D/ U- K, M
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
4 o: N1 V$ n+ v! A0 n% q </tr>
; @) H0 i( E* }* G$ k8 e6 b</table> _$ q2 A2 |3 y2 w0 s7 k
</form>
( }% T" ^: O3 d$ X3 z& M% a<script language="javascript">
9 U9 O# F+ d m$ S: M//人名移动1 j1 p$ n0 r2 t4 e+ c: S) z
function move(fbox, tbox) {4 z( n! U& u8 B* U# Z! ~
var arrfbox = new array();
& C& z0 E2 k0 }! Xvar arrtbox = new array();
- |1 O' D4 C8 l9 m9 Lvar arrlookup = new array();
9 e" K8 o6 v# r& s' k9 U9 P( J* Kvar i;
9 @4 ?! A# w/ Q3 C/ Yfor (i = 0; i < tbox.options.length; i++) {% |/ \! T% @6 S' R: z- A
arrlookup[tbox.options.text] = tbox.options.value;
" {. }1 P, c) d) A7 Warrtbox = tbox.options.text;
" s9 w$ u" u, v* t# _}$ @9 @8 {; w5 I* A. I6 v* j) n1 O
var flength = 0;% F( J8 \$ W ~) K0 u7 P3 ^8 T* d! c
var tlength = arrtbox.length;' y/ J% c, ?* l+ |3 [$ \4 j
for(i = 0; i < fbox.options.length; i++) {
, F+ H; E, d% {( E% L5 a& Yarrlookup[fbox.options.text] = fbox.options.value;
& ^3 C( V! t6 R. kif (fbox.options.selected && fbox.options.value != "") {
$ E4 y+ A# l" W8 F/ M* W& Narrtbox[tlength] = fbox.options.text;/ W4 c1 F, a. Q* V
tlength++;9 \7 H4 z2 R" g$ A7 [: w. p5 h" z
}3 s0 O1 l* L9 B2 l
else {+ ^2 J0 x$ i5 k! O7 c
arrfbox[flength] = fbox.options.text;
' x, ?8 i! v; o6 L1 r4 Qflength++;
. Q( K y( q' k }
2 C# M. N- S- _! j}! n; Q7 f' j" k$ `! ]
arrfbox.sort();
& H s; D9 B1 M G0 B5 earrtbox.sort();
4 y& g9 s6 b1 M
- M5 w/ R, x* C R6 j* W) t3 _fbox.length = 0;
5 E1 [* b. B: L: b( ktbox.length = 0;2 j8 G9 D5 O+ E
var c;$ e! L" C3 t+ w$ F; S
for(c = 0; c < arrfbox.length; c++) { Y4 _0 C7 o: Q: @# B
var no = new option();* w6 L- S1 D4 K- c8 e) o+ P
no.value = arrlookup[arrfbox[c]];
$ j" r( @2 T. |3 W; m( c5 Gno.text = arrfbox[c];
3 f% d* i7 Y5 X: T* H: Z2 Tfbox[c] = no;4 h) ?/ I& T) c) F
}( d) D% U5 t8 O/ n- S9 O1 _
for(c = 0; c < arrtbox.length; c++) {4 H$ n5 C2 y& M$ a
var no = new option();
* n3 V3 G- W" d) Y7 e8 nno.value = arrlookup[arrtbox[c]];& K( v" Y0 l8 { b* n4 t
no.text = arrtbox[c];
w- t" y0 m$ Z9 ~, V$ Vtbox[c] = no;, N* v6 V6 p, {# W7 j
}
6 A6 l9 [" U3 n z8 j}
: [1 X: I: n4 q/ l! K Q</script>
/ o9 @" m+ @6 h</body>
0 a! B2 A) g4 y |
|