订阅本栏目 RSS您所在的位置: 深山工作室 > ASP > 正文

asp模拟动态加载include file

网络 2014/8/25 7:48:01 深山 字体: 浏览 3779
fun.asp 模拟动态加载include的函数
<%
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>

相关阅读
连云港旅游网
从数据库管理下手提升网站安全
求实时获取两个input日期型值的差
ASP操作access或sqlserver数据库的函数库
爱尚学生网
网站需要SEO,基本的SEO建站要点
一个可以用来思考的故事,非常不错
rs操作数据表记录集对象的方法
更多信息>>栏目类别选择
百度小程序开发
微信小程序开发
微信公众号开发
uni-app
asp函数库
ASP
DIV+CSS
HTML
python
更多>>同类信息
ASP中Utf-8与Gb2312编码转换乱码问题的解决方法页面编码声明
asp显示随机密码
通过阿里云服务接口获得ip地址详细信息
iis点开后任务栏上有显示,但是窗口看不到的解决办法
RSA加密解密插件
微软Encoder加密解密函数
更多>>最新添加文章
dw里面查找替换使用正则删除sqlserver里面的CONSTRAINT
Android移动端自动化测试:使用UIAutomatorViewer与Selenium定位元素
抖音直播音挂载小雪花 懂车帝小程序
javascript获取浏览器指纹可以用来做投票
火狐Mozilla Firefox出现:无法载入您的Firefox配置文件 它可能已经丢失 或是无法访问 问题解决集合处理办法
在Android、iOS、Windows、MacOS中微信小程序的文件存放路径
python通过代码修改pip下载源让下载库飞起
python里面requests.post返回的res.text还有其它的吗
更多>>随机抽取信息
asp日历代码
jQuery设置提交表单disabled属性所有input、button、extarea、select、checkbox、radio都生效
CSS教程:CSS兼容的技巧
Javascript实现CSS代码高亮显示
uni-app微信小程序分享微信好友与分享到朋友圈功能
四川悠旅地旅游有限公司