晓宁博客

晓看天下事,宁做无心人;博文网中游,客来香满堂。

« 在Z-blog文章首和文章尾插入广告的方法轻松学习ASP之Server对象的属性 »

轻松学习ASP之response对象主要方法(三)

  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


原创文章如转载,请注明:转载自晓宁博客http://www.grnnet.com/

本文链接地址:http://www.grnnet.com/post/106.html


发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

订阅博客

  • 订阅我的博客:订阅我的博客
  • 通过Google订阅本站
  • 通过鲜果订阅本站

站内搜索






热文排行

最新评论及回复

最近发表

Powered By Z-Blog 1.8 Arwen Build 90619

Copyright © 2008 Grnnet.com All Rights Reserved.冀ICP备08105325号