双11狂欢大促

盲盒赢 定制羽绒服

开启惊喜盲盒,抽取你的专属好礼

— 惊喜奖品抢先看 —

请问如何加个循环,能显示生成html文件的过程

fwy12 fwy12 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
我用如下代码生成html网页正常,我想加入一个循环,让生成网页的过程显示出来:如果是生成4篇的话,显示如下。
.../html256.html生成完成
.../html257.html生成完成
.../html258.html生成完成
.../html259.html生成完成
然后页面调用info函数。

但是用如下代码后无法循环,仅显示.../html256.html生成完成,页面就不动了,但是四篇文章都生成html。

请问如何加个循环,实现上述显示功能呢。
引用
<!--#include file="../Inc/conn.asp"-->
<!--#include file="admin_check.asp"-->
<%
nd=CheckStr(Trim(request("nd")))
id=CheckStr(Trim(request("id")))
dd=CheckStr(Trim(request("dd")))
xd=CheckStr(Trim(request("xd")))
cd=CheckStr(Trim(request("cd")))
tn=CheckStr(Trim(request("tn")))

mid=CheckStr(Trim(request("mid")))
mxd=CheckStr(Trim(request("mxd")))

function getHTTPPage(url)
dim Http
set Http=server.createobject("MSXML"&"2.X"&"MLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytesToBSTR(Http.responseBody,"GB2312")
set http=nothing
if err.number<>0 then err.Clear
end function

Function BytesToBstr(body,Cset)
dim objstream
set objstream = Server.CreateObject("adodb.stream")
objstream.Type = 1
objstream.Mode =3
objstream.Open
objstream.Write body
objstream.Position = 0
objstream.Type = 2
objstream.Charset = Cset
BytesToBstr = objstream.ReadText
objstream.Close
set objstream = nothing
End Function

Sub CreateDefaulthtml()
Dim tRs,tSql
Dim Url,Html
Dim ClassID
dim filename,MDBpath,fso,fout
Server.ScriptTimeout=1000

Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set tRs=server.CreateObject("adodb.recordset")
If ND = 5 then
trs.open "select * from [Yao_Article] Where datediff('d',DateAndTime,now())=0 and yn=0 order by ID desc",conn,3,2
End if

If ND = 4 then
trs.open "select * from [Yao_Article] Where ClassID="&CD&" and yn=0 order by ID desc",conn,3,2
End if
If ND = 3 then
trs.open "select Top "&tn&" ID, * from [Yao_Article] Where yn=0 order by ID desc",conn,3,2
End if
If ND = 2 then
trs.open "select * from [Yao_Article] Where ID="&ID&" and yn=0 order by ID desc",conn,3,2
End if
If ND = 1 then
trs.open "select * from [Yao_Article] Where ID<="&DD&" and ID>="&XD&" and yn=0 order by ID desc",conn,3,2
End if
If ND = 0 then
trs.open "select * from [Yao_Article] Where yn=0 order by ID desc",conn,3,2
End if
While Not tRs.eof
Url="http://"&request.ServerVariables("Server_NAME")&""&SitePath&"html/?"&trs("id")&".html"
Html = getHTTPPage(Url)
filename="../html/"&trs("id")&".html"

'FilePath=Server.Mappath("/")
'Set Fso = Server.CreateObject("Scripting.FileSystemObject")
'If Not Fso.FolderExists(FilePath) Then Fso.CreateFolder (FilePath)

Set fout = fso.CreateTextFile(server.mappath(""&filename&""))
fout.Write html
%>
<%
tRs.movenext
Wend
tRs.close
fout.close
set fout=nothing
set fso=nothing
if err then
err.Clear
response.Write("error")
else
%>
<%=filename%>生成成功....

<%

Call Info("更新成功!")
end if
End Sub

Call CreateDefaulthtml()
%>


...全文

相关推荐

评论 13
收藏 已收藏
分享
返回顶部
fwy12
ASP 28,401 成员 356,940 内容