  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14247
- 金币
- 2414
- 威望
- 1647
- 贡献
- 1362
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"- ~6 f# l% m0 D4 C: B$ U
c pageencoding="gb2312"2 C3 V0 O; L1 L/ s1 \6 Z3 Y
%>
4 R2 I5 G- ?3 Z, s# v4 U<style>
" Q6 q2 l% b g' ~& Y# F& P/ I, x$ i j.f9{ font-size:9pt; }
! N" C- l, O4 [/ k.bgc{ background-color:#aecaf9; color: #0033ff }- h% @8 J9 x5 L
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
6 g3 s7 T: {8 A1 z border-bottom: solid 1px #4e7dc1;7 X7 v j+ B5 E# |: k0 P) n7 R
border-left: solid 1px #aecaf9;& l) \* E. D$ t/ @8 c
border-right: solid 1px #5679bd;
- W; m7 Y& v$ Z, [: p* D8 | padding:1px;2 P) q; n- N* W& l, J; a$ T
margin:0px;}
; W/ ?& S9 V2 M9 L</style>; o' e A4 r3 z3 m! P
<script language="javascript">
* F c$ Z* `' X8 S; U<!--
& M# E: X3 I2 q2 k3 Y* vfunction rv()3 m0 z* K4 W8 J( U% Y
{( X6 k8 y$ h, K& ~
var val="";/ E% q+ Y3 G, b+ Z b' p: m) v# j9 R
for(i=0;i<combo_box.list2.length;i++){5 k# A2 v& u# L' ^6 H
val+=","+combo_box.list2.value;( @2 |) H9 P. E' T4 k! p
}
0 S2 O% Z7 `0 b; j; L& u2 c if(val.charat(0)==","){
3 m) s0 K2 z) c. A0 R val=val.substr(1,val.length);; a5 }1 q# I/ ]. w- b1 K5 ?
}$ w$ v, `# k: d7 {9 c
opener.form1.frecname.value=val;
4 W/ ]. f) L+ L self.close();/ F% m2 [( v& a* @2 V- b
}# w# J/ E# }& j( Y
//-->9 D( E2 |, e9 S" B2 i+ T& S3 x
</script>6 U6 U+ N, X: o, c/ `6 L- m! `0 s
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">' i$ {& F( ]* ]
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />/ V! M: c% e& f+ s5 Y0 q6 X
<%, T; v* b$ H; I/ ~9 B O- R
cdatasource ds=new cdatasource(); //数据联结bean实例
g$ A+ j% o! G& G java.sql.connection conn=ds.getconnection();& G. u% P! J; r( N9 q% H" T, Q
java.sql.statement stmt=null;) O4 d9 v9 q& P2 D
java.sql.resultset rs=null;
2 F# X7 B* Z7 M* Z' K$ V8 V cdatacheck dc=new cdatacheck();
" i$ @& \, \0 F& m# {8 L4 A; q! U%>% P) `! X1 [# w' y1 U% i& D
<%- y8 t- l( M2 w% T
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";% W% ?. P) d7 {( R3 b, v3 |: z
stmt=conn.createstatement();
0 X0 l7 @6 r; E3 U" k2 vrs=stmt.executequery(sqlu);4 A8 u5 I9 F1 i: u& ]8 |
%>
$ j( n- S6 y, G. @<script language='javascript'>0 Z3 B7 f# D2 y# y
arr = new array();! u$ C! x& I$ v( q& K
<% int temp=0;
# W9 X% ~$ A1 U4 b/ {% ~while(rs.next())
9 c) Z# ^+ k$ z6 a{
1 ~! {4 a( ]- \1 @3 L4 ?8 A' k%>
/ A, {, s6 ~+ t* garr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");
* n% ~" V; B2 E' I<%
5 ~& Q& L* a2 r! x, [temp = temp + 1;
/ i( N/ Y e/ ]# K}
- R; p1 d6 c: c1 {%>
% Q& e" ~3 f- O/ C) s' W' u5 ?7 Ftemp=<%=temp%>;: q% e9 F/ }! M
function changelocation(id){ 6 w9 T( w9 I3 x# D* u7 F
document.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始 & f4 B5 E& Y6 _/ L4 q1 M$ l
var i = 0; - V* y% |3 R9 U3 J6 u: K$ a9 |! K! f
document.combo_box.city.options[0]=new option('-------',''); , C) Q: U$ r! E8 V/ z3 E1 Z5 j
for(i=0;i<temp;i++){ $ l- O" E% S) ?: B0 w/ I' D U
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门] : _. Q* r1 U( b) f8 m
document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
5 e2 |9 I: b, W* i; y}
. q2 m5 y+ A0 P} $ @3 X& h8 H4 C3 v! ^4 D2 S. [
}
- P$ e* W) H: T- X; W R+ P</script>8 L: [9 v) P$ U$ c" F9 O6 F
+ a8 A! W& e6 T$ q
<form name="combo_box">3 s3 j" K5 L& ~7 W: b3 G( G! L
<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">1 ^/ J7 F# h+ w7 D& S
<tr height="24">
* c2 N+ O1 s5 u7 j5 r <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>: d0 [1 |3 [. h- O+ N' t
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
' w! P+ B, [" q }" k9 r <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td>: R* G8 @3 \0 W) P* S) \+ V
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>" V# y' k& T3 J! f
</tr>
) I7 e; ?6 J) S& |1 _( f3 ] <tr>
* n' F5 E5 p! E3 u7 W' D0 N7 C1 s <td>
1 n; h# L+ o9 V# F" a1 e9 e <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">8 W1 }) f/ ]9 T8 q7 N1 Q/ f
<option value="0">请选择部门 ---></option>. N% d8 S( j( K# E& b% k+ c
<%- |, B0 f( g% v+ F. v% e
string sqld="select * from tdept";+ h N3 \' ~/ o5 N
stmt=conn.createstatement();1 f6 A1 I! Y7 O4 L
rs=stmt.executequery(sqld);$ r$ u5 z. M3 \" j4 B3 E5 B
while(rs.next())$ M1 w- `, o5 }& a4 L
{
; Z& B6 l$ k, k8 `* y w F9 w%>
6 `/ o( i& K9 Z <option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>; e7 _1 i' t* }9 Z' T1 x
<%0 W/ w4 s- x: ?- n: O, y! {: r
}: v$ W2 [$ p& k+ I; b5 Q+ Z
%>
9 N0 L1 ]0 s: z7 t9 [0 H s </select>
, p3 \' p3 E7 F v/ a</td>
- Q% i5 X h, O; L7 N, P <td>$ s3 w! q, T6 ? u/ s
<select multiple id=city style="width:150;height:200" class="bgc">) B4 ]( ~5 i+ S# V4 C) D
</select>
8 R/ n7 y! M) R6 L! L</td>+ X# N# P& ^1 j5 {3 H- s5 \; B* O
<td nowrap align="center" class="bgc">9 |$ r# S* }0 L* a6 b& p
<input type="button" value="<<" class="buttons">
/ j7 W: L M- d: q <input type="button" value=">>" class="buttons">
; C. N! H4 @, _2 D/ V8 i! t* |% E</td>' A4 U2 y: V3 o* Y: A
<td>
' q8 i: m4 i; i: E <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">! ?2 g) V* R8 ]! N
</select>
) W( k. B! ?* v</td>. `1 J: {$ |& k+ {1 Q& q) D
</tr>% d. ^2 l) e* y5 g8 g7 G
<tr class="bgc">
" o1 s" `1 ?% E2 I5 h4 ~ <td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>
( K8 h; [( P6 E5 { r% k: W </tr>5 F$ s( A# E# e' U
</table>
* a8 W: D' x v/ V h</form>
! |2 j1 y' D) a<script language="javascript">8 q; |. {6 a+ T. u: g7 y+ |0 r( x
//人名移动5 h8 b4 y& W) @4 e3 Z/ B( Q
function move(fbox, tbox) {4 P: c4 ]: ~& d( O: L$ j, U! c% U# ?/ C
var arrfbox = new array();5 k% ^4 v( i1 R6 O
var arrtbox = new array();
5 @) T; H6 T. A& | A, I1 a3 Zvar arrlookup = new array();# o- X, ]& F- A: X
var i;
% O& M& ]1 w! q* w0 ~# Gfor (i = 0; i < tbox.options.length; i++) {& B3 L: T' i7 l' l+ g6 z
arrlookup[tbox.options.text] = tbox.options.value;
) O4 N% m3 m4 f& Iarrtbox = tbox.options.text;
% n7 p( [2 T6 A% N m7 N}2 o" J# f/ m% J8 _' i) S" q
var flength = 0;8 s# ^! } c' G& N5 T7 p x0 l
var tlength = arrtbox.length;+ A- x9 Z; @: z9 k% b, a
for(i = 0; i < fbox.options.length; i++) {
2 V9 t1 W# z0 |* Darrlookup[fbox.options.text] = fbox.options.value;, c/ p; [" J7 f6 ]
if (fbox.options.selected && fbox.options.value != "") {
- H/ P# a+ D# y1 l, c$ m) R" _arrtbox[tlength] = fbox.options.text;
& B$ E. k" [, k9 }; L: i/ o* Otlength++;: R2 W7 P( r P- P6 a
}
: \$ }: @& B+ aelse {4 f$ u( y8 H" ]0 ] m6 O3 c
arrfbox[flength] = fbox.options.text;
+ R- W2 J( B) _0 j2 @! `. h% @) Hflength++;
+ V: t2 G+ [& P. d* _9 r, I }, o% @% v& L* k
}
" v; D$ N! I, Z% narrfbox.sort();
* r$ A" d6 V/ W0 R. rarrtbox.sort();
/ S0 I2 C* |7 g8 ?3 C3 U3 H1 x3 Q n( t7 I/ x6 E! k3 N- [1 {
fbox.length = 0;7 w6 L3 L; v4 J1 N' g, c5 ]
tbox.length = 0;/ ]5 @7 w# N9 _/ I$ _
var c;
( {0 K$ ?; [) U0 g9 z6 m7 ^+ d, B9 lfor(c = 0; c < arrfbox.length; c++) {
- x8 Z9 z) I/ [8 r; ^var no = new option();1 ^; e0 s/ P" L9 A
no.value = arrlookup[arrfbox[c]];
# ~7 H" @" d- ^no.text = arrfbox[c];# V4 B! X# c5 u% Y" r$ u
fbox[c] = no;! S2 ?# j1 }/ M( u- `
}
' \# i8 f+ `% H% f1 U! Y. F5 ?; V) x @for(c = 0; c < arrtbox.length; c++) {
3 A1 c9 L( X& ^, {& V( N4 Svar no = new option();
, k$ \4 u" }. i* C2 bno.value = arrlookup[arrtbox[c]];( Q3 @$ e4 x8 ^5 t! L8 g' o' S+ k
no.text = arrtbox[c];+ g- m ~- I* s6 c
tbox[c] = no;3 ]. Z" h6 J7 `- V' e
}2 x4 e4 O: ^; d+ }7 ]8 |) h1 b+ e- ?
}
! O+ L* X, t: o: v3 C. i$ ^</script>
6 s- n5 J7 @" w</body>
9 S6 u, x9 v7 Y: l1 R- _6 n1 A |
|