📄 bestcollect.asp
字号:
<!--#include file="function.asp"-->
<!--#include file="top.asp"-->
<%
if request("collect")="best" or request("collect")="myself" then
collect=request("collect")
else
errmsg=errmsg+"<li>请选定参数!</li>"
call error()
response.end
end if
action=request("action")
classid=request("classid")
if classid="" then classid=1
sql="select typeor from class where classid="&classid
rs.open sql,conn,1,1
if rs("typeor")="1" then
typeorsql="stamp"
else
typeorsql="pic"
end if
rs.close
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
%>
<table border="0" width=770 align=center cellspacing="1" cellpadding="1" bgcolor="#000000">
<tr>
<td bgcolor="#FF8ECE" align="center" width="163" valign="top"> <br>
<table width="90%" border="0" cellspacing="1" cellpadding="3" bgcolor="#000000">
<tr>
<td bgcolor="#FFF8DF">
<%
sql="select * from class"
rs.open sql,conn,1,1
do while not rs.eof
response.write "<img src=images/gb2.gif> <a href=bestcollect.asp?classid="&rs("classid")&">"&rs("class")&"</a><br><br>"
rs.movenext
loop
rs.close
%>
</td>
</tr>
</table>
</td>
<td bgcolor="#FFBAE7" width="600" height="2" align="center" valign="top">
<%
response.write "<input type=""button"" value=""按图片显示列表"" onclick=""javascript:window.open('bestcollect.asp?action=pic"
if request("page")<>"" then response.write "&page="&request("page")
response.write "classid="&classid&"&collect="&collect&"','_self')"">"&_
" <input type=""button"" value=""按文字显示列表"" onclick=""javascript:window.open('bestcollect.asp?action=text"
if request("page")<>"" then response.write "&page="&request("page")
response.write "&classid="&classid&"&collect="&collect&"','_self')"">"
if classid<>"" then sql=typeorsql&".classid="&classid&"and "
sql="select "&typeorsql&".id,"&typeorsql&".images,"&typeorsql&".title,"&typeorsql&".creattime,author.author from "&typeorsql&",author where "&typeorsql&"."&collect&"=true and "&sql&typeorsql&".authorid=author.authorid order by id desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<p align='center'>暂时没有收集</p>"
else
totalPut=rs.recordcount
if action="text" then
PageUrl="bestcollect.asp?action=text&classid="&classid&"&collect="&collect
else
PageUrl="bestcollect.asp?action=pic&classid="&classid&"&collect="&collect
end if
if currentpage<1 then currentpage=1
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
showpage totalput,MaxPerPage,PageUrl
if action="text" then
showtextContent
else
showcontent
end if
showpage totalput,MaxPerPage,PageUrl
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpage totalput,MaxPerPage,PageUrl
if action="text" then
showtextContent
else
showcontent
end if
showpage totalput,MaxPerPage,PageUrl
else
currentPage=1
showpage totalput,MaxPerPage,PageUrl
if action="text" then
showtextContent
else
showcontent
end if
showpage totalput,MaxPerPage,PageUrl
end if
end if
end if
rs.close
sub showContent
i=0
response.write "<table width=""100%""><tr>"
do while not rs.eof
i=i+1
if typeorsql="stamp" then
if instr(rs("images"),"|")>0 then
imagesarr=split(rs("images"),"|")
images=imagesarr(0)
end if
else
images=rs("images")
end if
response.write "<td align=center><a href="&typeorsql&"list.asp?id="&rs("id")&" target=_blank><img src="&images&" border=0 width=120></a><br>"&i&"."&rs("title")&"</td>"
if i>=MaxPerPage then exit do
if i mod 4=0 and i>=4 then response.write "</tr><tr>"
rs.movenext
loop
response.write "</table>"
end sub
sub showtextContent
i=0
response.write "<table width=""100%"">"&_
"<tr>"&_
"<td width=""55%"">标 题</td>"&_
"<td width=""25%"">作 者</td>"&_
"<td width=""20%"">创作日期</td>"&_
"</tr>"
do while not rs.eof
i=i+1
response.write " <tr>"&_
"<td width=""55%""><a href="&typeorsql&"list.asp?id="&rs("id")&" target=_blank>"&rs("title")&"</a></td>"&_
"<td width=""25%"">"&rs("author")&"</td>"&_
"<td width=""20%"">"&rs("creattime")&"</td>"&_
"</tr>"
if i>=MaxPerPage then exit do
rs.movenext
loop
response.write "</table>"
end sub
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<div align=right><form method=Post action="&filename&">"&_
"共找到<b>"&totalnumber&"</b>项记录"
if CurrentPage<2 then
response.write " 首页 上一页 "
else
response.write " <a href="&filename&"&page=1>首页</a> <a href="&filename&"&page="&CurrentPage-1&">上一页</a> "
end if
if n-currentpage<1 then
response.write "下一页 末页 "
else
response.write "<a href="&filename&"&page="&CurrentPage+1&">下一页</a> "&_
"<a href="&filename&"&page="&n&">末页</a>"
end if
response.write " 页次:<strong>"&CurrentPage&"/"&n&"</strong>页 转到:<select name='page' size='1' onchange='javascript:submit()'>"
for i = 1 to n
response.write "<option value="&i
if cint(CurrentPage)=cint(i) then response.write " selected "
response.write ">第"&i&"页</option>"
next
response.write "</select></form></div>"
end function
%>
</td>
</tr>
</table>
<!--#include file="copyright.asp"-->
</body>
</html>
<%
set rs=nothing
conn.close
set conn=nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -