日期:2014-05-20  浏览次数:20795 次

asp版的问题,搞不定发到这里。高手们看看
我需要根据不同情况使用不同的包含文件.比如说的根据参数的不同来判断使用某个文件如下:.
        Url中是:   http://www.163.com/index.asp?file=a.asp        
       
        <%str   =   request( "file ")%>
        <!--#include   file= <%=str%> ".asp "-->
问题是include中是不可以使用变量,在网上找过,但是都没有适合的方法,请问有经验的朋友能否提供一个好的办法.

------解决方案--------------------
我想不通为什么一定要分开include file?这是一个预处理,可以实现资源共享,是不错,但是请明白它的真正含义,它是预处理,不是函数或是方法。
正规的实现方法应是
把所有可能include file里面的方法全部放在一个页面并各自封装为函数或方法,比如:
a.asp
response.write "a "

b.asp
response.write "b "

c.asp
response.wrtie "c "

全部封装进Subs.asp
sub sA()
response.write "a "
end sub

sub sB()
response.write "b "
end sub

sub sC()
response.write "c "
end sub

好了,index.asp里第一行先include file= "Subs.asp "
str=request.querystring( "file ")
if(str== "a ")
call sA()
elseif(str== "b ")
call sB()
elseif(str== "c ")
call sC()
end if

结束。