jb51生成所有页面的效果+分页生成 原创

时间:2021-05-26

复制代码 代码如下:
<!--#includefile="conn.asp"-->
<styletype="text/css">
body,td,th{
color:#000000;
font-size:14px;
background-color:#D6DFF7;
}
</style>
<%
dimrs
setrs=server.CreateObject("adodb.recordset")
ifrequest("type")="date"then
yearstr=request("selyear")
monstr=request("selmonth")
daystr=request("selday")
ifdaystr<>""then
theymd=yearstr&"-"&monstr&"-"&daystr
sql="selectidfromnewswheredatetimelike'"&theymd&"%'orderbydatetimedesc"
else
theymd=yearstr&"-"&monstr&"-"
sql="selectidfromnewswheredatetimelike'"&theymd&"%'orderbydatetimedesc"
endif
elseifrequest("type")="new"then
topnew=request("newcount")
iftopnew<>""then
topnew=cint(topnew)
sql="selecttop"&topnew&"idfromnewsorderbydatetimedesc"
endif
elseifrequest("type")="nosh"then
sql="selectidfromnewswhereshengcheng=0"
elseifrequest("type")="all"then
sql="selectidfromnewsorderbyiddesc"
endif
ifsql<>""then
response.writesql
response.write"<center><b><fontcolor=""#FF0000"">正在生成文章内容页的Html页,请等待......</font></b><spanid=showImport></span></center><IE:DownloadID=""oDownload""STYLE=""behavior:url(#default#download)""/>"
ifrequest("p")<>""then
p=cint(request("p"))
else
p=1
endif
MaxPerPage=100
rs.opensql,conn,1,1
ifnotrs.eofthen
rs.pagesize=MaxPerPage'得到每页数
mpage=rs.pagecount'得到总页数
allshu=rs.recordcount'得到总数
rs.move(p-1)*MaxPerPage
dowhilenotrs.eof
i=i+1
callMakeHtml()
ifi>=MaxPerPagethenexitdo
rs.movenext
loop
endif
rs.close
Sshu=MaxPerPage*p-MaxPerPage+1'当前已经生成的数量
Tshu=Sshu+i-1'已生成生成的
ifallshu<Sshuthen
setrs=nothing
conn.close
setconn=nothing
response.redirect"makehtmlall.asp?type=ok"&"&shu="&request("shu")&"&D="&d&"&p="&p+1
response.end
else
%>
<metahttp-equiv="refresh"content="0;url=makehtmlall.asp?type=<%=request("type")%>&newcount=<%=request("newcount")%>&selyear=<%=request("selyear")%>&selmonth=<%=request("selmonth")%>&selday=<%=request("selday")%>&shu=<%=Tshu%>&D=<%=D%>&p=<%=p+1%>">
<divalign="center"><br>正在生成:第(<%=Sshu%>/<%=Tshu%>)个共<%=allshu%>个</div>
<%
endif
SubMakeHtml()
%>
<script>functiononDownloadDone(downDate){showImport.innerHTML=downDate}oDownload.startDownload('makehtml.asp?news_id=<%=rs("id")%>',onDownloadDone)
</script>
<%
endSub
'-----------------------sql为空-------------------
else
setrstotal=conn.execute("selectcount(*)fromnews")
nowtotal=rstotal(0)
rstotal.close
setrstotal=nothing
setnosh=conn.execute("selectcount(*)fromnewswhereshengcheng=0")
nownosh=nosh(0)
nosh.close
setnosh=nothing
'-------------------
ifrequest("type")="ok"then
%><divalign="center">
<br><br>操作成功:共生成页面
<fontcolor="#FF0000"><%=request("shu")%></font>个,完成时间<%=now()%>
</center>
<%
endif
'-------------------------
%>
<tablewidth="511"border="0"align="center"cellpadding="10"cellspacing="1"bgcolor="#FFFFFF">
<formaction="makehtmlall.asp?type=date"method="post"><tr>
<tdwidth="99"height="25"nowrapbgcolor="#D6DFF7">按日期生成:</td>
<tdwidth="369"nowrapbgcolor="#D6DFF7"><selectname="selyear">
<%
foryearstr=2001toyear(date)
ifyearstr=year(date)then
response.write"<optionvalue="&yearstr&"selected>"&yearstr&"</option>"
else
response.write"<optionvalue="&yearstr&">"&yearstr&"</option>"
endif
next
%>
</select>-
<selectname="selmonth">
<%
formonstr=1to12
ifmonstr=month(date)then
response.write"<optionvalue="&monstr&"selected>"&monstr&"</option>"
else
response.write"<optionvalue="&monstr&">"&monstr&"</option>"
endif
next
%>
</select>-
<selectname="selday">
<optionvalue=""""></option>
<%
fordaystr=1to31
ifdaystr=day(date)then
response.write"<optionvalue="&daystr&"selected>"&daystr&"</option>"
else
response.write"<optionvalue="&daystr&">"&daystr&"</option>"
endif
next
%>
</select>
<inputtype="submit"name="Submit"value="生成"></td>
</tr>
</form>
<formaction="makehtmlall.asp?type=new"method="post">
<tr>
<tdheight="25"nowrapbgcolor="#D6DFF7">按最新的生成:</td>
<tdnowrapbgcolor="#D6DFF7">生成最新的
<inputname="newcount"type="text"id="newcount"size="10">
个文章
<inputtype="submit"name="Submit2"value="生成"></td>
</tr>
</form>
<formaction="makehtmlall.asp?type=nosh"method="post">
<tr>
<tdheight="25"nowrapbgcolor="#D6DFF7">没有生成过的:</td>
<tdnowrapbgcolor="#D6DFF7">当前需要生成文章[<fontcolor="red"><%=nownosh%></font>]
<inputtype="submit"name="Submit4"value="生成"></td>
</tr>
</form>
<formaction="makehtmlall.asp?type=all"method="post">
<tr>
<tdheight="25"nowrapbgcolor="#D6DFF7">生成全部:</td>
<tdnowrapbgcolor="#D6DFF7">共[<fontcolor="red"><%=nowtotal%></font>]
<inputtype="submit"name="Submit3"value="生成"></td>
</tr>
</form>
</table>
<%
endif
%>

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章