CASE 1 %>
<!--#include virtual="whatever1.asp"-->
CASE 2 %>
<!--#include virtual="whatever2.asp"-->
CASE 3 %>
<!--#include virtual="whatever3.asp"-->
三个包含文件在代码执行前就已导入页面了。
你可以这样:
whichfile="1"%>
<!--#include virtual="whatever.asp"-->
这看起来好像有些合理。
<!--#include virtual="whatever.asp"-->
解决的方法是:
includedynamic.asp
whichfile="bookscifi.asp"
Call ReadDisplayFile(whichfile)
response.write "
"
whichfile="bookhorror.asp"
Call ReadDisplayFile(whichfile)
response.write "
"
whichfile="/learn/test/bookmarketing.asp"
Call ReadDisplayFile(whichfile)
response.write "
"
%>
SUB ReadDisplayFile(FileToRead)
whichfile=server.mappath(FileToRead)
Set fs = CreateObject("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile(whichfile, 1, False)
tempSTR=thisfile.readall
response.write tempSTR
thisfile.Close
set thisfile=nothing
set fs=nothing
END SUB
%>
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10294527/viewspace-124603/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10294527/viewspace-124603/