随便什么方法的话
那就用最简单的<input type="file" name="aaaaaa" >

解决方案 »

  1.   

    <html>
    <script language="javascript">
    function doreturn(){
       var strReturn="";
     
       strReturn=document.theForm.added.options[document.theForm.added.selectedIndex].value;
       //alert(strReturn);
      window.returnValue=strReturn;
       window.close()
    }
    </script>
    <%
    String strid="file";
    String path = request.getRealPath(strid);//&frac12;¨&Aacute;&cent;&acute;ú±í&Auml;&iquest;&Ccedil;°&Auml;&iquest;&Acirc;&frac14;&Icirc;&raquo;&Ouml;&Atilde;&micro;&Auml;d±&auml;&Aacute;&iquest;
    File d = new File(path);
    //&Egrave;&iexcl;&micro;&Atilde;&acute;ú±í&Auml;&iquest;&Acirc;&frac14;&Ouml;&ETH;&Euml;ù&Oacute;&ETH;&Icirc;&Auml;&frac14;&thorn;
    File list[] = d.listFiles();
    %>
    <body>
    <table align=center border=1>
    <form name="theForm">
    <tr>
          <td width="120"> 
                   <select size="12" name="added" multiple style="width:100%;" ondblclick="javascript:addit(added,tobeadd)">
       <%for(int i=0; i < list.length; i++)
                        {
     
                     if(list[i].isDirectory()){}else{
                         %>
    <option value="<%=list[i].getName()%>"><%=list[i].getName()%></option>
    <%
     }
    }
     %>
                   </select> 
                </td>
    </tr>
    <tr>
    <td>
    <input type=button value="&Egrave;·&para;¨" onclick="doreturn();">
    </td>
    </tr>
    </form>
    </table>
    </body>
    </html>
      

  2.   

    <html>
    <script language="javascript">
    function doreturn(){
       var strReturn="";
     
       strReturn=document.theForm.added.options[document.theForm.added.selectedIndex].value;
       //alert(strReturn);
      window.returnValue=strReturn;
       window.close()
    }
    </script>
    <%
    String strid="file";
    String path = request.getRealPath(strid);//建立代表目前目录位置的d变量
    File d = new File(path);
    //取得代表目录中所有文件
    File list[] = d.listFiles();
    %>
    <body>
    <table align=center border=1>
    <form name="theForm">
    <tr>
          <td width="120"> 
                   <select size="12" name="added" multiple style="width:100%;" ondblclick="javascript:addit(added,tobeadd)">
       <%for(int i=0; i < list.length; i++)
                        {
     
                     if(list[i].isDirectory()){}else{
                         %>
    <option value="<%=list[i].getName()%>"><%=list[i].getName()%></option>
    <%
     }
    }
     %>
                   </select> 
                </td>
    </tr>
    <tr>
    <td>
    <input type=button value="确定" onclick="doreturn();">
    </td>
    </tr>
    </form>
    </table>
    </body>
    </html>