ASP Response 对象

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

<html>
<body>
<%
response.write("<h2>您可以使用 HTML 标签来格式化文本</h2>")
%>


<%
response.write("<p style='color:#0000ff'>这段文本的样式是通过 style 属性添加的。</p>")
%>

</body>
</html>

<%
if Request.Form("select")<>"" then
       Response.Redirect(Request.Form("select"))
end if
%>
  
2:将用户重定向至不同的 URLs
<html>
<body>

<form action="/example/aspe/demo_aspe_redirect.asp" method="post">

<input type="radio" name="select"
value="/example/aspe/demo_aspe_server.asp">
服务器实例<br />

<input type="radio" name="select"
value="/example/aspe/demo_aspe_text.asp">
文本实例<br /><br />
<input type="submit" value="跳转!">

</form>

</body>
</html>

3:显示随机的链接

<html>
<body>

<%
randomize()
r=rnd()
if r>0.5 then
  response.write("<a href='http://www.w3school.com.cn'>W3School.com.cn!</a>")
else
  response.write("<a href='http://www.news.cn'>news.cn!</a>")
end if
%>

4:本例演示如何清空缓存。

<%
Response.Buffer=true
%>

<html>
<body>
<p>
当您的 response 缓存清空时,这段文本就会发送到浏览器。
</p>
<%
Response.Flush
%>

</body>
</html>

<p>
本例演示一个链接,每当您加载本页时,就会显示两个链接之一:W3School.com.cn! 或 news.cn!各占百分之五十的几率。
</p>

</body>
</html>

5:<%
Response.End
%>

6:

<%
Response.ExpiresAbsolute=#May 05,2001 05:30:30#
%>

7:<%Response.Expires=-1%>
<html>
<body>
<p>每当被访问,本页都会被刷新!</p>
</body>
</html>

8:

<html>
<body>

<%
If Response.IsClientConnected=true then
Response.Write("用户仍然保持连接。")
else
Response.Write("用户未连接。")
end if
%>


</body>
</html>

9:

<%
Response.ContentType="text/html"
%>

<html>
<body>

<p>This is some text.</p>

</body>
</html>

10:

<%
Response.Charset="ISO8859-1"
%>

<html>
<body>

<p>This is some text</p>

</body>
</html>

posted on 2012-01-09 16:46  念念啊  阅读(1043)  评论(0编辑  收藏  举报