该用户从未签到
|
<% //String servletPath=request.getServletPath();
" |$ p' z7 L) A+ O. ] // int end =servletPath.lastIndexOf('/')+1;
. T: `& e @: m0 g* l" f //System.out.println(end);
" u- M( i0 U( _4 T //String photoPath=servletPath.substring(0,end);
! r1 Y: Q1 ~8 \% s J String path=request.getRequestURI();
y9 N! u1 u. m" u0 o //System.out.println(path);& B" F) t5 Y1 g2 `! b( n( R" Q
int end =path.lastIndexOf('/')+1;: M, Z* ^. B+ S. r' @
String photoPath=path.substring(0,end);
% |1 C }7 p- S* V" O8 C0 Y% E System.out.println(photoPath);
. y/ l4 K& Y1 l0 i9 i7 c' `! x) v0 ^ %>6 E1 b& b3 r/ Q+ W
<script language="javascript">8 ], D( H' a% X$ n. `/ \' ~$ v
function showPic(obj) {6 z+ t3 V; W. K3 u
var o = document.getElementById("showimg"); P% Z: |5 J+ T7 Q
var b = document.getElementById("photoPath");
4 t( R9 x1 Y# P4 J/ | var i=obj.value.lastIndexOf('s')+2;3 x2 }) F- E& k7 n% H2 |; F
var j=obj.value.length;6 w9 ?. l9 A' T, k8 E3 T
//var a = document.image.value;9 C, p& g+ ]' W& [ e* u
//var int j=a.length; b3 M, z, K' ?/ `, u
//var i=a.lastIndexOf('s')+2;
0 d+ c2 o! p, S0 z x$ F var filename=obj.value.substring(i,j);( J/ [8 S$ I% g4 e0 Q
o.src=b.value+"images/"+filename;1 ?' c# p5 x1 f: \
o.style.display="";' w- |8 U8 ]! ]5 z, `
o.border=1;
$ @3 P0 u' j1 q3 k f3 o }( t8 x" O$ p2 D9 e
</script>
7 ], z/ F! S5 p- W* X<form>
7 V$ W8 s# ^3 _4 W<input name="image" type="file" id="image" size="50" >
6 n7 E6 _+ x4 h% \1 s: P& K<div align="center"><img name="showimg" id="showimg" src="" style="display:none;" alt="预览图片" /></div>
; ~8 t! p& x) T- _, M4 e. `4 I6 w/ B</form> |
|