#include void main() { float R1,R2,Rp,Rs; scanf("%f%f",&R1,&R2); Rp=R1*R2/(R1+R2); Rs=R1+

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/30 01:08:49
#include void main() { float R1,R2,Rp,Rs; scanf(

#include void main() { float R1,R2,Rp,Rs; scanf("%f%f",&R1,&R2); Rp=R1*R2/(R1+R2); Rs=R1+
#include void main() { float R1,R2,Rp,Rs; scanf("%f%f",&R1,&R2); Rp=R1*R2/(R1+R2); Rs=R1+

#include void main() { float R1,R2,Rp,Rs; scanf("%f%f",&R1,&R2); Rp=R1*R2/(R1+R2); Rs=R1+
的方法,这种方法在以前的版本中是不存在的.
<include file="<%=var%>.asp">这种用法是不行的.
凡是include语句,都不可以使用asp变量,参见《ASP宝典》.
但你一定要用include,也是有方法的:
思路:把<include file="<%=var%>.asp">整个作为一个字符串变量,然后自己写需要显示的asp程序.
比如需要动态显示、含有include的文件是MyProduct.asp
那么在转到MyProduct.asp之前,我在另一个文件中写入:
如:
<%
写入文件名变量
FilePath="../viewreports/info"&pid&".htm"
''将文件写入myproduct.asp以供调用
set fs=server.CreateObject("Scripting.FileSystemObject")
AbPath=Server.MapPath("/mysite/viewreports/MyProduct.asp")
set ts=fs.CreateTextFile(AbPath,true)
TxtStr="<html><body><table><!--#include File=""" & FilePath & """ --></table></body></html>"
ts.writeline TxtStr
ts.close
set ts=nothing
set fs=nothing
''将页面转向myproduct.asp
response.redirect "/mysite/viewreports/MyProduct.asp"
end if
%>