Properti ASP Buffer
Atribut Buffer menentukan apakah output buffer. Biasanya, script ASP dijalankan di server, setiap kalimat dari hasil eksekusi dikirim untuk ditampilkan pada browser client. Ketika output buffer diatur, server akan mencegah respon ke browser sampai semua script server sudah diproses, atau sampai script panggilan metode Siram atau End.
Catatan: Jika Anda mengatur properti ini, itu harus datang sebelum file .asp <html> tag.
tatabahasa
response.Buffer[=flag]
参数 | 描述 |
---|---|
flag | 布尔值,规定是否缓冲页面输出。
False 指示不缓存,服务器会一边处理一边发送输出。IIS version 4.0 默认为 False,而 IIS version 5.0 及更高的版本默认为 True。 True 指示缓冲。服务器不会发送输出,直到页面上的所有脚本被处理,或者直到 Flush 或 End 方法被调用。 |
contoh
contoh 1
Dalam contoh ini, sebelum akhir siklus tidak akan dikirim oleh output browser. Jika buffer diatur ke False, maka sekali per siklus ke jalur output dari browser.
<%response.Buffer=true%>
<html>
<body>
<%
for i=1 to 100
response.write(i & "<br>")
next
%>
</body>
</html>
<html>
<body>
<%
for i=1 to 100
response.write(i & "<br>")
next
%>
</body>
</html>
contoh 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>
<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>
contoh 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>
<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>
Lengkap Response Referensi Obyek