<%
Function qwbminclude(filename)
Dim re,content,fso,f,aspStart,aspEnd
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.pattern="^\s*="
aspEnd=1
aspStart=inStr(aspEnd,content,"<%")+2
do while aspStart>aspEnd+1
Response.write Mid(content,aspEnd,aspStart-aspEnd-2)
aspEnd=inStr(aspStart,content,"%\>")+2
Execute(re.replace(Mid(content,aspStart,aspEnd-aspStart-2),"Response.Write "))
aspStart=inStr(aspEnd,content,"<%")+2
loop
Response.write Mid(content,aspEnd)
set re=nothing
End Function
%>
time.asp 测试上面动态加载函数效果
<!--#include file="fun.asp"-->
<%
tid = "1"
response.write include(tid&".asp")
%>
1.asp 测试加载之后的效果
<!--#include file="fun.asp"-->
<h3><%=tid%></h3>
<h1>111111111111111111</h1>
<h2><%=now()%></h2>
<%response.write include("b.asp")%>
2.asp 测试加载之后的效果
<!--#include file="fun.asp"-->
<h3><%=tid%></h3>
<h1>22222222222222222</h1>
<h2><%=now()%></h2>
<%response.write include("b.asp")%>
b.asp 这个页面是用来测试嵌套加载效果
<!--#include file="fun.asp"-->
现在时间:<hr>
<%=time()%><br />
<%=now()%><br />
<h3><%=tid%></h3>