Buffer

阅读:23      收藏:0      [点我收藏+]

ASP Buffer 属性


Buffer 属性可规定是否对输出进行缓冲。通常情况下,ASP 脚本在服务器端执行,每句的执行结果都会发送到客户端的浏览器上显示出来。当输出设置缓存时,服务器会阻止向浏览器的响应,直到所有的服务器脚本均被处理,或者直到脚本调用了 Flush 或 End 方法。

注意:如果要设置此属性,它应当位于 .asp 文件中的 <html> 标签之前。

语法

response.Buffer[=flag]

参数 描述
flag 布尔值,规定是否缓冲页面输出。

False 指示不缓存,服务器会一边处理一边发送输出。IIS version 4.0 默认为 False,而 IIS version 5.0 及更高的版本默认为 True。

True 指示缓冲。服务器不会发送输出,直到页面上的所有脚本被处理,或者直到 Flush 或 End 方法被调用。

实例

实例 1

在这个实例中,在循环结束前不会被浏览器发送输出。如果 buffer 被设置为 False ,则每循环一次就向浏览器输出一行。

<%response.Buffer=true%>
<html>
<body>
<%
for i=1 to 100
response.write(i & "<br>")
next
%>
</body>
</html>

实例 2

<%response.Buffer=true%>
<html>
<body>
<p>I write some text, but I will control when
the text will be sent to the browser.</p>
<p>The text is not sent yet. I hold it back!</p>
<p>OK, let it go!</p>
<%response.Flush%>
</body>
</html>

实例 3

<%response.Buffer=true%>
<html>
<body>
<p>This is some text I want to send to the user.</p>
<p>No, I changed my mind. I want to clear the text.</p>
<%response.Clear%>
</body>
</html>
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!