<script>
function getfile()
{
for(i=0;i<document.all.photofile.length;i++)
alert(document.all.photofile[i].value);
}
</script>
<input type="file" name="photofile" style="width:;height:22">
<input type="file" name="photofile" style="width:;height:22">
<input type="file" name="photofile" style="width:;height:22">
<input type=button value=getfile onclick=getfile()>

解决方案 »

  1.   

    <script>
    myarray=new Array();
    function getfile()
    {
    for(i=0;i<document.all.photofile.length;i++)
    {
    myarray[i]=document.all.photofile[i].value;
    alert(myarray[i]);
    }
    }
    </script>
    <input type="file" name="photofile" style="width:;height:22">
    <input type="file" name="photofile" style="width:;height:22">
    <input type="file" name="photofile" style="width:;height:22">
    <input type=button value=getfile onclick=getfile()>
      

  2.   

    如何把这个数组传递到下一个jsp页面呢?谢谢!
      

  3.   

    那就不用数组,直接提交,在jsp页面中用Stirng[] myarr=request.getParameterValues("photofile")接收,同名的自动形成数组