ASP 编程常用代码精选集合 十四 编程
常用代码精选集合(十四 十四)
减小字体 5:asp 自动生成 html 并覆盖原 html : 增大字体
<% dim read,Curl,content
Function getHTTPPage(url) dim http set http=Server.createobject("Microsoft.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 Curl="localhost/index.asp" read=getHTTPPage(Curl)
if read<>"" then content=read Set Fso = Server.CreateObject("Scripting.FileSystemObject") Filen=Server.MapPath("index.html") Set Site_Config=FSO.CreateTextFile(Filen,true, False) Site_Config.Write content Site_Config.Close Set Fso = Nothing Response.Write("") end if %>
6:asp 生成 html 代码 :
<% 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 Dim Url,Html Url="jz123" Html = getHTTPPage(Url) dim filename,MDBpath,fso,fout filename="index.htm" MDBpath="/" Set fso = Server.CreateObject("Scripting.FileSystemObject") Set fout = fso.CreateTextFile(server.mappath(""&;filename&;"")) fout.Write html fout.close set fout=nothing set fso=nothing if err then response.Write("生成首页失败") else response.Write("生成首页成功") end if %>
7:asp 站内搜索代码 站内搜索 搜索代码
body 区:
8:判断 ASP 页装载完毕 判
= function()