index.asp,asp代码部分
if Request.QueryString("id")="" thenresponse.write"<SCRIPT language=JavaScript>alert('ID错误!')"
response.write"javascript:history.go(-1)</SCRIPT>"
else
id= Request.QueryString("id")
url = "http://www.ceshi.com/"&id&".html"
dim a,b
a=GetPage(url)
b=GetContent(a,"url=""","html",0)&"html"
'urlb = "http://www.ceshi.com/2015/06/28/123456.html"
'要求:21.html中格式为url="XXX.XX"前缀url=,后面是双引号
'还是有些不明白,生成html的时候地址直接写进数据库不好么,
'文章表对应ID 存储html地址这样
urlb=b
end if
ComStrindex = GetPage(urlb)
Set Re=new RegExp
Re.Global = True
listbody = GetContent(ComStrindex,"<!DOCTYPE","</html>",1)
set reg = new regexp
reg.global = true
reg.ignorecase = true
reg.pattern = "包含内容:""(.*?)"""
set baohan = reg.execute(listbody)
<%On Error Resume Next
dim conn
dim connstr
dim webdb
webdb="xqloginback/xqjtDatabase/xqjtdb.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0Data Source=" &Server.MapPath(""&webdb&"")
conn.Open connstr
newlist=""
set rs=server.CreateObject("adodb.recordset")
sql="select id,name,addtime from new order by id desc"
rs.open sql,conn,1,1
pagesum=10
topage=clng(request("topage"))
if topage<1 then topage=1
rs.pagesize=pagesum
if not rs.eof then
rs.absolutepage=topage
end if
no=1
do while not rs.eof and not rs.bof and pagesum>0
newlist=newlis&"<table width='90%' height='25' border='0' align='center' cellspacing='0'>"
newlist=newlis&"<tr>"
newlist=newlis&"<td width='539'><a href='new_view.asp?id="&rs("id")&"' target='_blank'>"&rs("name")&" </a></td>"
newlist=newlis&"</tr></table>"
<%
rs.movenext
pagesum=pagesum-1
no=no+1
loop
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set templates = fso.OpenTextFile(server.MapPath("template.html"))
str=templates.readall()'读出结果,赋值给str
set fso=nothing
set templates=nothing
str=replace(str,"$newlist$",newlist)
fileName="28ke.html"
Set createHtml = Server.CreateObject("Scripting.FileSystemObject")
Set htmlFile = createHtml.CreateTextFile(server.MapPath(fileName))
htmlFile.write(str)
set htmlFile=nothing
set createHtml=nothing
%>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)