  
- UID
- 1
- 帖子
- 738
- 精华
- 28
- 积分
- 14195
- 金币
- 2388
- 威望
- 1647
- 贡献
- 1336
|
<%@ page import="java.util.date,yava.fileapp.*,java.sql.*;"" G6 x6 c; Z6 H c! `
c pageencoding="gb2312": F6 G1 A6 a* C9 d
%>- S: V) Z- k; N9 [# h% {
<style>
' H6 G# c* T3 r8 ?.f9{ font-size:9pt; }
- i+ D) G q5 w4 _2 s( f# E' |7 ].bgc{ background-color:#aecaf9; color: #0033ff }4 r4 Y. u5 |1 A4 y) e# U2 R9 v
.buttons{font-family:arial; font-size:13px; font-weight:bold; background-color:#6796e4; color:white; border-top: solid 2px #aacafb;
3 q |& k- ]: N+ C border-bottom: solid 1px #4e7dc1;
* q: ^* z% _$ f7 ^/ F X border-left: solid 1px #aecaf9;
5 y z [, P( b/ G, ~( P3 E border-right: solid 1px #5679bd;
; V) e* R. _) z) b f1 V: ]$ w padding:1px;
+ r7 B7 w; m0 N& P! s, @# i2 d6 D4 H+ u margin:0px;}
& a5 d- `/ @& O2 g3 G</style>( b- H5 T. ~; p3 X& H
<script language="javascript">
# y( P2 z$ a* h9 o) \. T0 N% q<!--
6 I# V3 S' a! [6 O) g/ x5 ~function rv()
" {! g7 m) q* O+ j; F: U{ G6 I# h$ _- O6 l% r0 R
var val="";1 B d5 [+ O4 S" Y* V4 N# C n
for(i=0;i<combo_box.list2.length;i++){( H( S+ K* m5 N( |5 Z/ o
val+=","+combo_box.list2.value;8 [- L p! [4 J
}
/ w' t5 q7 i3 y6 ^. \6 z1 b4 X. m if(val.charat(0)==","){6 g, {* V* j8 f- C" D' U" P- v
val=val.substr(1,val.length);
! c$ ]% @; W2 u3 D+ w5 T8 s& Y }
9 r% d* F! o d! A% G opener.form1.frecname.value=val;; {; \2 T% ]/ g
self.close();$ `# N1 E( o. C3 Z( `$ m9 i
}
2 p% m; e, Q6 ]$ i9 h$ ~//-->+ X! |+ k; L u# m& R
</script>
- i' ^" ?$ ?/ s; J1 U<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"> B. |+ A& a* M- P( f( ~$ Y, C. N
<jsp:usebean id="user" scope="session" class="yava.fileapp.userbean" />
! C3 o8 k8 B& ^2 D' S! y7 `/ Q<%; H% a4 j; y8 `, n* G+ H; T% o
cdatasource ds=new cdatasource(); //数据联结bean实例
- ?, |- f/ U$ ?4 N1 @; V java.sql.connection conn=ds.getconnection();% Z* _7 Q7 L5 b3 j
java.sql.statement stmt=null;6 G% o: B+ n" ?2 m
java.sql.resultset rs=null;
& w; [. h( l: I) m$ R$ i& k cdatacheck dc=new cdatacheck(); z2 q$ u$ ?* P
%>
( _7 _# A2 M! w& h<%8 _ w- g$ Q# l3 C. 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";4 H( d, _: M* S4 `- Q& ^* Y
stmt=conn.createstatement();' L4 V9 N- A! k H! I: ?
rs=stmt.executequery(sqlu);& O' o8 G; j$ j6 F3 |# F q
%>
' ~/ m" i+ @; D: n0 T<script language='javascript'>
+ Z& q' ?% U+ E/ ?/ ~1 Narr = new array();3 Q/ j! _1 p/ _* M4 O+ @
<% int temp=0;8 Y- p' w- O, a/ m0 F* _
while(rs.next())
! P- E. C! i' W* K{
9 U/ }% T d' ^+ |9 v# r%>
& S' V; _5 [: m- Xarr[<%=temp%>]=new array("<%=rs.getstring("fname")%>","<%=rs.getstring("fdept")%>");4 o J0 D' e2 K0 W5 E
<%' S) H* |* U& p4 Y
temp = temp + 1;
4 O. y6 J# S, ^1 |}# L0 T& H8 j7 _& A; }
%>
# S5 ~4 ]& k% ltemp=<%=temp%>;
( J+ a5 f* q% ^. [ n6 _function changelocation(id){
+ m8 W/ R) b( _; A# \! h, Edocument.combo_box.city.length=0; //初始化第2级菜单的长度,下标从0开始
) g- j4 O E' w2 }9 U' S' n tvar i = 0; , [" N6 j( I# @8 l9 E$ V2 ^1 n
document.combo_box.city.options[0]=new option('-------',''); & E+ S5 T8 e) @
for(i=0;i<temp;i++){ 6 `! ?# B. p+ V8 j5 l( \5 \3 U, S
if(arr[1]==id){//如果相等,证明在第2级里面有输入第1级组织的子集,arr[总数目][部门]
: V' V# d% C2 P8 K; N' r5 _document.combo_box.city.options[document.combo_box.city.length] = new option(arr[0], arr[0]);
6 J- l9 [6 z! D' c6 \} . E0 f/ \1 ]/ T) w1 H
} 0 y, [- r' d8 d2 k* g( F
}
' R6 `" ^7 F' n3 s. }( S. V: R</script>2 ^: A. [* t! E" C. o1 B+ r/ Z
) G4 k+ ^4 I2 J<form name="combo_box">
7 Q1 L6 W7 L8 s3 L6 s" e<table border="0" cellspacing="0" cellpadding="0" height="210" width="59">
" I3 p. h& Q, b3 P8 c <tr height="24">3 @9 E1 o) H& }( ]- A
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>部门选择</font></td>
8 k6 D( K4 {+ \4 ? <td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>人名选择</font></td>
0 \. j" q1 _' E! P2 Q' W4 l <td bgcolor="#336699" class="buttons" align=center nowrap><font color=#ffffff>添加/移除</font></td> B9 F4 W& n% D0 N. R, M+ ?
<td bgcolor="#336699" class="buttons" align=center><font color=#ffffff>最终人</font></td>
8 `! @6 q0 S. N1 K3 k+ e" O </tr>4 D6 n* {2 R1 P# E
<tr> 4 l$ r1 V- Q: h# D' i; P1 C) \: h8 H
<td>
0 J& n+ _! k6 I9 }- ~! G3 e <select multiple id=prov name="prov" style="width:150;height:200" class="bgc">
4 @$ }5 o6 O4 ~4 P <option value="0">请选择部门 ---></option>
4 x( ?/ @$ S6 y<%6 B: Z8 e/ O: Q* w& J$ @
string sqld="select * from tdept";( m3 J7 Y0 B+ \, Q' c$ ~
stmt=conn.createstatement();0 \7 \8 j& e' g, J/ y. \ d
rs=stmt.executequery(sqld);
) A. b1 c3 |. M8 G) M+ k/ Nwhile(rs.next())
7 @7 z& |) g- H7 ]- `% W: |{
) C0 r% {' z. ^$ T%>( G/ V2 w2 s( Q1 G7 K! m9 g: x$ V4 Y
<option name="<%=rs.getstring("fno")%>"><%=rs.getstring("fname")%></option>- y2 u( X* T2 K, B2 z* L
<%
: c9 f1 O: \3 U, g) F3 U* b: A7 D6 n}
6 ?$ c& C. ~0 Z* U* @%> % N) y9 @- B4 @
</select>
6 L A2 j& G& p% S& s) \$ U3 _( z' H</td>
? s' T `7 w5 a; H <td>2 N( m `2 [* q6 R/ m; f4 U
<select multiple id=city style="width:150;height:200" class="bgc"># z2 g% s& A, ~) ]; e) }! y) i8 m& t
</select>9 x4 x/ j; y) i g$ U! z% b9 G
</td># b# C5 [5 p, a2 v
<td nowrap align="center" class="bgc">1 |8 i* G: k9 s% j
<input type="button" value="<<" class="buttons">
8 u5 J/ x5 a2 `8 A$ `) p; D: h5 ^# {( L <input type="button" value=">>" class="buttons">
" |1 f9 D9 @( `: M( o</td>
4 F. Q. a% r, @7 U& n, T% g4 x% { <td>
+ X/ E$ B/ k8 S' Y. Z <select multiple size="10" name="list2" style="width:150;height:200" class="bgc">4 j, P+ ?! C, c. I, k- O4 A- ^
</select>
3 M* j, }; b4 a</td>( A; Z& X7 N. T9 V1 E' P
</tr>
$ x) ^: P" g4 [- C# [ <tr class="bgc"> ( {3 p) P' b8 m4 A
<td colspan="4" align="center"><input type="button" name="button1" class="buttons" value="选好了!" ></td>1 \8 {5 V+ H# e9 M
</tr>
$ }% S: \8 O9 r7 U</table>. g7 k5 p K* u+ o, Y+ w- I6 x
</form>
0 \' g- a# d% X$ J) T<script language="javascript">
# o" f; T- Y: f* ]9 t; H//人名移动# d8 w5 {8 K8 ?. I8 \/ S
function move(fbox, tbox) {
2 ^+ J" t. s4 U. G$ T+ Q. Nvar arrfbox = new array();7 F% q7 n& @( n. c5 R1 \
var arrtbox = new array();
/ r' Q$ s* m& @, Jvar arrlookup = new array();& M) F- x; M1 Z1 w3 ?. x: V+ W$ e9 c
var i;
7 {+ g- {* Q5 |, Kfor (i = 0; i < tbox.options.length; i++) {# x3 g* B% n; m5 `
arrlookup[tbox.options.text] = tbox.options.value;
; a" M8 D! t8 N6 n7 t7 Oarrtbox = tbox.options.text;# x: [7 W8 L& A |2 M6 q
}; t8 v% |* u' R, j5 Y, b
var flength = 0;
4 {7 [7 R9 c) |+ G5 M7 R1 Qvar tlength = arrtbox.length;
% h" S% ~7 x% A6 I3 c Kfor(i = 0; i < fbox.options.length; i++) {
. Y1 s/ I9 J, k/ ?arrlookup[fbox.options.text] = fbox.options.value;
- j( x! C, j r& k) iif (fbox.options.selected && fbox.options.value != "") {
], [) o6 m4 i) k5 k, Barrtbox[tlength] = fbox.options.text;# I' I7 D! a! V& z" t
tlength++;
' Z+ M F% G6 g9 T& M) E}
, q1 [, v( y) L4 Welse {
3 u7 T7 ~; j4 j* m" I. }6 Karrfbox[flength] = fbox.options.text;% l8 {! n& K3 A5 ]. K( E/ U
flength++;9 X8 W P$ z: t- Q
}
# P; e3 g' r& [0 h ^1 C}* \) I% b* a. q8 O6 a* X
arrfbox.sort();
; k- ?. A/ u$ t0 Jarrtbox.sort();! R6 A# q0 u! P ~
+ r% Q, Z) s, ^( J6 X# l& x+ K8 }
fbox.length = 0;" a0 F% q8 T5 Y* u- R' o t
tbox.length = 0;- m7 `% N- _ t$ [) C( H
var c;
! r( ~9 Y$ l9 w/ z% Xfor(c = 0; c < arrfbox.length; c++) {. u+ G$ C: s5 s. B) {
var no = new option();
4 J3 j( \7 Q- g8 U' bno.value = arrlookup[arrfbox[c]];
) `+ v! g$ m% N* i% cno.text = arrfbox[c];
% T2 `; F( N0 u5 o2 @3 X# m- Lfbox[c] = no;- u }7 j& a# ^4 ?2 l" `/ ^0 q
}/ z: t; g; I+ A# j
for(c = 0; c < arrtbox.length; c++) {
" K: ~# k- Y& U: Y L3 |# [var no = new option();) D' P& R+ N/ D: ]
no.value = arrlookup[arrtbox[c]];
1 l9 I$ }5 }7 N# ^( xno.text = arrtbox[c];! N; e. D* F. F% O$ x
tbox[c] = no;
0 d7 _+ H2 T' I7 |4 ^0 [1 G }
0 y* C. Y3 c9 N0 @5 F' f}9 U4 P* i- |& I1 {
</script>2 |( V$ V+ B& r& O
</body>
0 D, _- t6 ? v# C3 O: r: ~ |
|