该用户从未签到
|
<% //String servletPath=request.getServletPath(); & k! M, H* e( S3 l, e8 p1 U
// int end =servletPath.lastIndexOf('/')+1;5 j0 n/ u/ I4 x/ V/ i
//System.out.println(end);
* `. v7 @6 `, ?- g" g- M //String photoPath=servletPath.substring(0,end);" A8 C( c& y: n |7 V) v
String path=request.getRequestURI();6 W, M" E3 u0 z% I% O+ R
//System.out.println(path); D* [6 S5 I {
int end =path.lastIndexOf('/')+1;
. U$ L+ c( D* r' x4 k8 d String photoPath=path.substring(0,end);2 {: {( C- W: n- v2 ?
System.out.println(photoPath);
3 S" X. A% W% A, T& e C) U %>
. R* @# ^8 \; A( V: x- m<script language="javascript">
3 n" y% s, d5 L+ S function showPic(obj) {
0 g% S3 \% g* b* H+ K1 l( T5 y5 q: o- z var o = document.getElementById("showimg");2 d" G1 F% t$ p% B
var b = document.getElementById("photoPath");! A' l" S L9 J& r/ f# z- T
var i=obj.value.lastIndexOf('s')+2;
$ g* J6 D6 I- [0 t9 [' t& c var j=obj.value.length;
& l3 h6 V5 m j5 c! o: [ //var a = document.image.value;1 ?; \' y. Z: F% S$ H6 o
//var int j=a.length;
: Z0 |- r# S1 |- T) ^' \& X //var i=a.lastIndexOf('s')+2;7 n; g8 H6 x& R
var filename=obj.value.substring(i,j);8 p5 _( `! J! O9 v& E* `
o.src=b.value+"images/"+filename;( R5 L" @9 q9 Y! s& Z
o.style.display="";$ g! g5 d8 D. }5 } p; J. |6 Z
o.border=1;
9 P5 r( j% }0 P1 J }
/ \) u7 K$ F7 v7 q& o3 `0 n N+ p0 u5 m</script>
% k+ a. O* c+ _) t2 p" u8 G<form>8 M ~( Q/ U# ]/ T3 s
<input name="image" type="file" id="image" size="50" >
$ B* a) B+ W! m! x. k9 o8 p5 v<div align="center"><img name="showimg" id="showimg" src="" style="display:none;" alt="预览图片" /></div>; U [: q4 t" y4 j1 \) y+ q5 p3 ?
</form> |
|