3、Clear方法
Clear方法用于清除在缓存里的html输出数据,缓存中的内容通过Response对象的buffer属性为true而存储在服务器缓存中,使用clear方法就可以清除缓存中的内容,语法如下:
<% response.clear %>
使用时需要注意以下两点:
(1)使用它的前提条件是必须先使response.buffer为true,否则运行时会出错。
(2)使用clear方法清除的是从服务器传来的html中的body部分,而不会清除其他部分,head部分的内容仍旧被发送到客户浏览器。
4、End方法
End方法用于中止ASP运行并返回到网页中,End方法也需要先使response.buffer为true才能使用,否则运行时会出错。语法如下:
<% response.end %>
例
<% response.buffer=true %>
<html>
<body>
<%
response.write "我喜欢ASP"
response.end
response.write "我爱ASP"
%>
</body>
</html>
上面的程序运行时只执行第一条response.write语句,结果仅显示“我喜欢ASP”这句话。
如果将clear方法和end方法联合使用,程序就不会向浏览器输出任何信息,如下例:
<% response.buffer=true %>
<html>
<body>
<%
response.write "我喜欢ASP"
response.write "我爱ASP"
%>
response.end
</body>
</html>
5、Flush方法
Flush方法用来将缓存中的数据立即发送到客户浏览器,同clear方法和end方法一样也需要先将buffer属性设为true,否则会在运行时出错,语法为:
<% response.flush %>
上一节:[轻松学习ASP之Response对象主要方法(二)] 下一节:[轻松学习ASP之Server对象的属性]
原创文章,如需转载,请注明出处:
本文转自:晓宁博客 [ http://www.grnnet.com ]
原文地址:http://www.grnnet.com/post/106.html