日期:2014-05-17  浏览次数:21264 次

如何用FSO提取文件夹中所有文件并分页
如何用FSO提取文件夹中所有文件并分页

程序代码:
<%      
pageSize=1  
fder= "pic "        
Set       fso       =       CreateObject( "Scripting.FileSystemObject ")        
set       objfolder=fso.GetFolder(server.mappath(fder))        
%>  
            <table   width= "720 "   border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
<%  
for   each   objfile   in   objfolder.files      
if   FileCount> =pageSize   then  
elseif   c> pageSize*(CurrentPage-1)   then
%>  
                <tr   onMouseOver= "this.bgColor= '#EAEAEA ' "   onMouseOut= "this.bgColor= ' ' ">
                    <td   width= "160 "   height= "130 "   align= "center "> <div   style= "position:relative;width:150px;height:120px;overflow:hidden;border:1px   solid   #CCCCCC; "> <img   src= <%=(fder   &   "/ "   &   objfile.name)%>   width= "150 "   border= "0 "> </div> </td>
                    <td   width= "66 "   height= "130 "   align= "center "> <input   name= "ddd "   type= "checkbox "   id= "ddd "   value= " <%=(fder   &   "/ "   &   objfile.name)%> "> </td>
                    <td   width= "494 "   height= "130 "   style= "word-break   :   break-all; "   class= "font2 "> <%=(fder   &   "/ "   &   objfile.name)%> </td>
                    </tr>
                <tr>
<%    
FileCount=FileCount+1  
end   if    
next    
%>  
                    <td   height= "60 "   align= "center "> <input   type= "submit "   name= "Submit "   value= "执行删除任务 "> </td>
                </tr>
            </table>

------解决方案--------------------
你先得到文件夹下文件数目,然后再计算分页。

------解决方案--------------------
<% on error resume next

pageSize=3
fder= "../a "
Set fso = CreateObject( "Scripting.FileSystemObject ")
set objfolder=fso.GetFolder(server.mappath(fder))
%>
<form name= "form1 " method= "post " action= "?action=delfile ">

<table width= "720 " border= "1 " align= "center " cellpadding= "0 " cellspacing= "0 "