网上客房预订系统(ASP+Access+系统功能结构图+文件架构图+源代码) 第11页
if (requestpage-1)*MaxPage<totalPut then
showContent
showpage2 strFileName,totalput,MaxPage
else
requestpage=1
showContent
showpage2 strFileName,totalput,MaxPage
end if
end if
else
response.write "找不到文件夹!可能是配置有误!"
end if
end if
sub showContent()
dim c
FileCount=0
TotleSize=0
%>
通过以下代码实现分页跳转功能、通过复选框删除选中的文件的相关程序代码如下所示:
<%
end sub '显示页码的过程
sub showpage2(sfilename,totalnumber,MaxPage)
dim n, i,strpage
if totalnumber mod MaxPage=0 then
n= totalnumber \ MaxPage
else
n= totalnumber \ MaxPage+1
end if
strpage= "<table align='center'><form name='showpages'method='Post' action='" & sfilename & "'><tr><td>"
strpage=strpage & "共 <b>" & totalnumber & "</b> 个文件 "
if requestpage<2 then
strpage=strpage & "第一页 上一页 "
else
strpage=strpage & "<a href='" & sfilename & "?page=1'>第一页</a> "
strpage=strpage & "<a href='" & sfilename & "?page=" & (requestpage-1) & "'>上一页</a> "
end if
if n-requestpage<1 then
strpage=strpage & "下一页 尾页"
else
strpage=strpage & "<a href='" & sfilename & "?page=" & (requestpage+1) & "'>下一页</a> "
strpage=strpage & "<a href='" & sfilename & "?page=" & n & "'>尾页</a>"
end if
strpage=strpage & " 页次:<strong><font color=red>" & requestpage & "</font>/" & n & "</strong>页 "
strpage=strpage & " <b>" & MaxPage & "</b>" & "个文件/页"
strpage=strpage & " 转到:<select name='page' size='1' onchange='javascript:submit()'>"
for i = 1 to n
strpage=strpage & "<option value='" & i & "'"
if cint(requestpage)=cint(i) then strpage=strpage & " selected "
strpage=strpage & ">第" & i & "页</option>"
next
strpage=strpage & "</select>"
strpage=strpage & "</td></tr></form></table>"
response.write strpage
end sub
sub DelFile() '删除文件过程
dim selectfile,splitFileName,i
selectfile=trim(Request("FileName")) '获取选中文件集合
if selectfile="" then exit sub '如果文件为空跳出过程
if instr(selectfile,",")>0 then
splitFileName=split(selectfile,",")
for i=0 to ubound(splitFileName)
if left(trim(splitFileName(i)),3)<>"../" and left(trim(splitFileName(i)),1)<>"/" then
selectfile=server.MapPath(UploadPath & "/" & trim(splitFileName(i)))
set thisfile=fso.GetFile(selectfile)
thisfile.Delete True
end if
next
else '只选中一个文件时,利用循环逐个删除文件
end if
end if
Response.Write("<script>alert(""删除成功"");location.href=""adminpic.asp"";</script>")
end sub
%>
图片管理页面的运行结果如图18所示。