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

asp模拟动态加载include file

网络 2014/8/25 7:48:01 深山 字体:大 中 小 浏览 3820
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>

相关阅读
用uni-app里面的navigator做链接时感觉像有缓存只能点其中一个链接
购买系统多久可以安装?
了解html基础知识之html标签集合
HTML文档中meta标签的作用
利用css3中的-webkit-font-smoothing把网页文字的毛边去掉
旅行社企业单位团队游主题定制
常用CSS缩写语法总结
滑动展开/收缩广告(兼容ff/ie6/ie7)
更多信息>>栏目类别选择
百度小程序开发
微信小程序开发
微信公众号开发
uni-app
asp函数库
ASP
DIV+CSS
HTML
python
更多>>同类信息
ASP中Utf-8与Gb2312编码转换乱码问题的解决方法页面编码声明
asp显示随机密码
通过阿里云服务接口获得ip地址详细信息
iis点开后任务栏上有显示,但是窗口看不到的解决办法
RSA加密解密插件
微软Encoder加密解密函数
更多>>最新添加文章
2026 aliyun阿里域名云注册续费优惠口令
dw里面查找替换使用正则删除sqlserver里面的CONSTRAINT
Android移动端自动化测试:使用UIAutomatorViewer与Selenium定位元素
抖音直播音挂载小雪花 懂车帝小程序
javascript获取浏览器指纹可以用来做投票
火狐Mozilla Firefox出现:无法载入您的Firefox配置文件 它可能已经丢失 或是无法访问 问题解决集合处理办法
在Android、iOS、Windows、MacOS中微信小程序的文件存放路径
python通过代码修改pip下载源让下载库飞起
更多>>随机抽取信息
生意就是这样做成的
做在线客服时,聊天窗口的div滚动条始终在底部
深山留言板教师节效果
一个省市县三级关联select下拉菜单代码
ASP中SQL和Access数据库中时间/日期字段内容查询的方法说明
深山留言板css安装教程