·您的位置: 首页 » 资源教程 » 编程开发 » ASP » RESPONSE对象1

RESPONSE对象1

类别: ASP教程  评论数:0 总得分:0
Response对象非常重要,而且有许多特性。我们将关注其最常用的一些功能。可用于
80%场合的20%的功能。

response.write
response.write的变体 <%= %>它可使ASP方便地插入HTML中
response.end which 有效地中止代码
response.redirect 调用其它页面
下面是一个实例,用response.write发送信息到浏览器。同时用到了dateadd,一个
内建功能,相关文档在:
http://help.activeserverpages.com/iishelp/VBScript/htm/vbs90.htm.

<html><head>
<title>response.asp</title>&
<body color="#FFFFFF">
<%
when=now()
tommorow=dateadd("d",1,when)
twoweekslater=dateadd("ww",2,when)
fourteenweekdayslater=dateadd("w",14,when)
monthlater=dateadd("m",1,when)

sixminuteslater=dateadd("n",6,when)
sixhourslater=dateadd("h",6,when)
fortysecslater=dateadd("s",40,when)

response.write "Now <b>" & when & "</b><br>"
response.write "tommorow <b>" & tommorow & "</b><br>"
response.write "2 weeks from Now <b>" & twoweekslater & "</b><br>"
response.write "fourteen working days from Now <b>" &
fourteenweekdayslater & "</b><br>"
response.write "1 month from Now <b>" & monthlater & "</b><br>"
%>
six minutes from now <b> <%=sixminuteslater%> </b><br>
six hours from now <b> <%=sixhourslater%> </b><br>
fourty seconds later <b> <%=fortysecslater%> </b><br>
</body></html>



下面是用response.end终止一个页面操作:

<html><head>
<title>end.asp</title>&
<body color="#FFFFFF">
<%
when=now()
tommorow=dateadd("d",1,when)
twoweekslater=dateadd("w",2,when)
monthlater=dateadd("m",1,when)
sixminuteslater=dateadd("n",6,when)
sixhourslater=dateadd("h",6,when)

response.write "Now <b>" & when & "</b><br>"
response.write "1 month from Now <b>" & monthlater & "</b><br>"
response.end
response.write "2 weeks from Now <b>" & twoweekslater & "</b><br>"
%>
six minutes from now <b> <%=sixminuteslater%> </b><br>
six hours from now <b> <%=sixhourslater%> </b><br>
-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1