baobao1987 发表于 2008-1-21 21:28:18

谁帮我看看这代码错在哪,顺便改下。。谢谢

<% //String servletPath=request.getServletPath();
   // int end =servletPath.lastIndexOf('/')+1;
//System.out.println(end);
//String photoPath=servletPath.substring(0,end);
String path=request.getRequestURI();
//System.out.println(path);
int end =path.lastIndexOf('/')+1;
String photoPath=path.substring(0,end);
System.out.println(photoPath);
%>
<script language="javascript">
function showPic(obj) {
var o = document.getElementById("showimg");
var b = document.getElementById("photoPath");
var i=obj.value.lastIndexOf('s')+2;
var j=obj.value.length;
//var a = document.image.value;
//var int j=a.length;
//var i=a.lastIndexOf('s')+2;
var filename=obj.value.substring(i,j);
o.src=b.value+"images/"+filename;
o.style.display="";
o.border=1;
}
</script>
<form>
<input name="image" type="file" id="image" size="50" >
<div align="center"><img name="showimg" id="showimg" src="" style="display:none;" alt="预览图片" /></div>
</form>

xh1123 发表于 2008-6-17 11:28:51

呵呵

这样谁看得出来哦,把整个文件贴出来。。。看看 ,,呵呵

8760747 发表于 2008-9-2 20:49:12

怎么也得把错误的信息发来吧
这样能帮你看看
页: [1]
查看完整版本: 谁帮我看看这代码错在哪,顺便改下。。谢谢