欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【asp动态页面生成html页面】,下面是详细的分享!
asp动态页面生成html页面
dim hughchiu_rtcode
Function get_exe_code(filename)
dim execode
dim tmp_str
Dim re,re1,content,fso,f,aspStart,aspEnd
dim ms,m
execode=""
set fso=CreateObject("Scripting.FileSystemObject")
set f=fso.OpenTextFile(server.mappath(filename))
content=f.ReadAll
f.close
set f=nothing
set fso=nothing
set re=new regexp
re.ignorecase=true
re.global=true
re.pattern="<%@[^%]+%>"
content=re.replace(content,"")
re.global=false
re.pattern="<!--s*#includes*files*=s*""([^""]+)""s*-->"
do
set ms=re.execute(content)
if ms.count<>0 then
set m=ms(0)
tmp_str=get_exe_code(m.submatches(0))
content=re.replace(content, tmp_str)
else
exit do
end if
loop
set m=nothing
set ms=nothing
re.pattern="^s*="
aspEnd=1
aspStart=inStr(aspEnd,content,"<%")+2
set re1=new RegExp
re1.ignorecase=true
re1.global=false
re1.pattern="response.Write(.+)"
do while aspStart>aspEnd+1
execode=execode&vbcrlf&" hughchiu_rtcode=hughchiu_rtcode&"""&replace( replace(Mid(content,aspEnd,aspStart-aspEnd-2),"""",""""""), vbcrlf,
"""&vbcrlf&""")&""""&vbcrlf
aspEnd=inStr(aspStart,content,"%>")+2
tmp_str=Mid(content,aspStart,aspEnd-aspStart-2)
do
set ms=re1.execute(tmp_str)
if ms.count<>0 then
set m=ms(0)
tmp_str=re1.replace(tmp_str, " hughchiu_rtcode=hughchiu_rtcode&"&m.submatches(0))
else
exit do
end if
loop
set m=nothing
set ms=nothing
execode=execode& re.replace(tmp_str,"hughchiu_rtcode=hughchiu_rtcode&")
aspStart=inStr(aspEnd,content,"<%")+2
loop
set re1=nothing
set re=nothing
execode=execode&vbcrlf&" hughchiu_rtcode=hughchiu_rtcode&"""&replace( replace(Mid(content,aspEnd), """", """"""), vbcrlf, """&vbcrlf&""" )
&""""&vbcrlf
get_exe_code="<%"&execode&"%>"
End Function
function asp2html(filename)
dim code
code=replace( replace( replace( get_exe_code(filename), "hughchiu_rtcode=hughchiu_rtcode&"""""&vbcrlf, "" ), "<%", "" ), "%>", "" )
'response.Write(code)
execute(code)
'response.Write( hughchiu_rtcode )
asp2html=hughchiu_rtcode
end function
%>
以上所分享的是关于asp动态页面生成html页面,下面是编辑为你推荐的有价值的用户互动:
相关问题:asp动态网页生成静态页面
答:1)asp生成html的方式 要生成文件肯空要用到FSO(FileSystemObject)组件,通过asp生成静态网页主要有两种方式: a、生成的内容由多部分连接而成; b、生成的内容基于模板生成。 2)方式1:生成的内容由多部分连接而成 步骤: a、设计要输出网页... >>详细
相关问题:Asp.net动态生成html页面
答:思路一: 无标题文档 此功能适用于后台数据库功能不强的web站点,即大部分文本不是存放在数据库的记录中,而是放在html文件或者xml文件中,仅仅把索引放到数据库中,如文章标题、类别、查询关键字等。这样适合于后台没有诸如MS Sql Server这样的... >>详细
相关问题:如何将ASP网页生成HTML网页?
答:以下代码就是将一个ASP的动态页面生成一个HTML的静态页面,注释我已经加上了,自己看吧。 FileName = "Index"&Item_Classid&".htm" FilePath = Server.MapPath("/")&"\"&FileName Html_Temp = Html_Temp&FilePath&"" 以上代码是在建立最终生成静... >>详细
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
