asp怎么样转换成html 代码发表日期:2012-3-12 文章来源:本站 浏览: 次
<% ID=CheckID(Request.QueryString("ID")) session("help")=int((10-1+1)*Rnd + 1) server.ScriptTimeout=9999 function getHTTPPage(url) dim Http set Http=server.createobject("MSXML2.XMLHTTP") 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 '''''''''''''''''''此处是要生成的静态页的地址'''''''''''''''''''''''''''''''''''''''''' txtURL="http://www.51wisdom.com.cn/news_con.asp?id="&id ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' sText = getHTTPPage(txtURL) Set FileObject=Server.CreateObject("Scripting.FileSystemObject") filename=server.MapPath("/")&"/html/"&id&".html" Set openFile=FileObject.OpenTextfile(filename,2,true) 'true为不存在自行建立 openFile.writeline(sText) Set OpenFile=nothing function checksql(kustr) checksql=server.htmlencode(replace(replace(replace(kustr,"<>"," "),"* from "," "),"="," ")) end function response.Write("<script language=javascript>alert('信息发布成功!');window.location.href='list.asp';</script>") %> |