分类广告


推荐文章

  • 没有找到任何内容!
您当前的位置:中国站长下载网络编程ASP专区 → 文章内容

ASP基础教程之实例学习ASP Response 对象

  • 作者:不详    来源:网络转载    发布时间:2007-11-13 13:04:02
  • 字体大小:

ASP Response 对象用于从服务器向用户发送输出的结果。 Chinaz^com

实例 中国.站.长站

使用ASP写文本 站.长站

本例演示如何使用ASP来写文本。 中国.站.长站

以下为引用的内容:
<html>
<body>
<%
response.write("Hello World!")
%>
</body>
</html>
中.国.站.长.站

在ASP中使用HTML标签格式化文本

Chinaz^com

本例演示如何使用ASP将文本和HTML标签结合起来。 中.国.站长站

以下为引用的内容:
<html>
<body>
<%
response.write("<h2>You can use HTML tags to format the text!</h2>")
%>
<%
response.write("<p style='color:#0000ff'>This text is styled with the style attribute!</p>")
%>
</body>
</html>
Chinaz_com

将用户重定向至不同的URL

Chinaz

本例演示如何将用户重定向至另一个的URL。 中.国.站.长.站

以下为引用的内容:

<%
if Request.Form("select")<>"" then
       Response.Redirect(Request.Form("select"))
end if
%>
<html>
<body>
<form action="/example/aspe/demo_aspe_redirect.asp" method="post">
<input type="radio" name="select"
value="/example/aspe/demo_aspe_server.asp">
Server Example<br>
<input type="radio" name="select"
value="/example/aspe/demo_aspe_text.asp">
Text Example<br><br>

中.国.站.长.站


<input type="submit" value="Go!">
</form>
</body>
</html> 站长.站

Www@Chinaz@com

显示随机的链接

中国.站.长站

本例演示一个超级链接,当您每次载入页面时,它将显示两个链接中的其中一个。

中国.站长站

以下为引用的内容:

<html>
<body>
<%
randomize()
r=rnd()
if r>0.5 then
  response.write("<a href='http://webjx.com'>;webjx.com</a>")
else
  response.write("<a href='http://www.webjx.com'>;www.webjx.com</a>")
end if
%>
<p>
This example demonstrates a link, each time you load the page, it will display
one of two links: Webjx.com! OR www.webjx.com! There is a 50% chance for
each of them.
</p>
</body>
</html>

中国站长_站,为中文网站提供动力

中.国站长站

控制缓存

中国站.长.站

本例演示如何控制缓存。 中国站.长站

以下为引用的内容:

<%
Response.Buffer=true
%>
<html>
<body>
<p>
This text will be sent to your browser when my response buffer is flushed.
</p>
<%
Response.Flush
%>
</body>
</html>

中国.站.长站

中.国.站.长.站

清空缓存 Www~Chinaz~com

本例演示如何清空缓存。 [中国站长站]

以下为引用的内容:
<%
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>
Chinaz~com

在处理过程中终止脚本并返回结果 Chinaz@com

本例演示如何在处理过程中中断脚本的运行。

Chinaz@com

以下为引用的内容:
<html>
<body>
<p>I am writing some text. This text will never be<br>
<%
Response.End
%>
finished! It's too late to write more!</p>
</body>
</html>

中国站.长.站

设置在页面失效前把页面在浏览器中缓存多少分钟

中国站.长站

本例演示如何规定页面在失效前在浏览器中的缓存时间。 Www~Chinaz~com

以下为引用的内容:
<%Response.Expires=-1%>
<html>
<body>
<p>This page will be refreshed with each access!</p>
</body>
</html>
中国.站.长站

设置页面缓存在浏览器中的失效日期或时间

Chinaz.com

本例演示如何规定页面在浏览器中的缓存时间日期或时间 Www~Chinaz~com

以下为引用的内容:
<%
Response.ExpiresAbsolute=#May 05,2001 05:30:30#
%>
<html>
<body>
<p>This page will expire on May 05, 2001 05:30:30!</p>
</body>
</html>
中国站长_站,为中文网站提供动力

检查用户是否仍然与服务器相连

中国.站.长站

本例演示如何检查用户是否已与服务器断开。

Www_Chinaz_com

以下为引用的内容:
<html>
<body>
<%
If Response.IsClientConnected=true then
Response.Write("The user is still connected!")
else
Response.Write("The user is not connected!")
end if
%>
</body>
</html>
Chinaz^com

设置内容类型

中.国站长站

本例演示如何规定内容的类型。 中国站长_站,为中文网站提供动力

以下为引用的内容:
<%
Response.ContentType="text/html"
%>
<html>
<body>
<p>This is some text</p>
</body>
</html>

中国.站长站

设置字符集 站.长.站

本例演示如何规定字符集的名称。

中国站.长.站

以下为引用的内容:
<%
Response.Charset="ISO8859-1"
%>
<html>
<body>
<p>This is some text</p>
</body>
</html>
Chinaz_com

Response 对象 Www_Chinaz_com

ASP Response 对象用于从服务器向用户发送输出的结果。它的集、属性和方法如下:

中国站长.站

Chinaz^com

中.国站长站

Www^Chinaz^com