当前位置: 首页 > 网络学院 > 服务端脚本教程 > ASP > ASP Buffer属性

ASP
ASP 介绍
ASP Install
ASP 语法
ASP 变量
ASP Procedures
ASP Forms
ASP Cookies
ASP Session
ASP Application
ASP #include
ASP Global.asa
ASP Send e-mail
ASP Response
ASP Request
ASP Application
ASP Session
ASP Server
ASP Error
ASP FileSystem
ASP TextStream

ASP Buffer属性


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 339 ::
收藏到网摘: n/a

The Buffer property specifies whether to buffer the output or not. When the output is buffered, the server will hold back the response to the browser until all of the server scripts have been processed, or until the script calls the Flush or End method.
使用Buffer属性可以指定是否将输出的数据放入缓冲器。当缓冲器开启时,服务器将保留本应该立即反馈给浏览器的信息,直到所有服务器脚本都进行过了,或是脚本调用了Flush或End方法

Note: If this property is set, it should be before the <html> tag in the .asp file
注意:如果这个属性设置了,那么它应该出现在<hrml>标签之前

语法

response.Buffer[=flag]

参数 描述
flag A boolean value that specifies whether to buffer the page output or not.
用布耳值来决定是否对页面的输出进行缓冲

False indicates no buffering. The server will send the output as it is processed. False is default for IIS version 4.0 (and earlier). Default for IIS version 5.0 (and later) is true.
Flash则表示不使用缓冲。服务器会将进程中的信息立即输出。在IIS4.0或是更早的版本中其默认值为Flse,IIS5以后的版本默认值则为true

True indicates buffering. The server will not send output until all of the scripts on the page have been processed, or until the Flush or End method has been called.
True则表示使用缓冲。服务器将保留本应该立即反馈给浏览器的信息,直到所有服务器脚本都进行过了,或是脚本调用了Flush或End方法

举例

举例 1

In this example, there will be no output sent to the browser before the loop is finished. If buffer was set to False, then it would write a line to the browser every time it went through the loop.
在这个举例中,在服务器完成对循环的运算以前不会将结果输出到浏览器上。如果缓冲被设置为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>

评论 (0) All

登陆 | 还没注册?