日期:2011-06-21 浏览次数:20943 次
<html>
<head>
<title> response.asp </title>
<body color = "#FFFFFF" >
<p>
<%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 "现在时间:
<b>" & when & "</b> <br>"response.write "明天此时:
<b>" & tommorow & "</b>
<br>"response.write "一月以后此时:
<b> " & monthlater & " </b>
<br>"%>从现在以后6秒钟:<b> <%= sixminuteslater %> </b>
<br> 从现在以后6小时是:<b> <%= sixhourslater %> </b>
<br> 从现在以后40秒是: <b> <%= fortysecslater %> </b>
<br> </body> </html>
执行以后的界面如下:
图01:response.write发送信息到浏览器
response.end 是如何有效地中止代码?
下面是用response.end终止一个页面操作的源程序end.asp和执行后的运行界面:
end.asp:
<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 "现在时间:
<b>" & when & " </b>
<br> "response.write "从现在以后一个月时间: <b>" & monthlater & "</b> <br>"response.endresponse.write "从现在以后二周时间:
<b>" & twoweekslater & "</b>
<br>"%>从现在以后6秒时间:
<b> <%= sixminuteslater %> </b>
<br> 从现在以后6个小时:<b>
<%= sixhourslater %> </b>
<br>
运行此程序,则执行界面如下:
图02:end.asp程序执行界面
在end.asp程序中可见多了一个response.end语句:如果没有这个语句,则程序执行后的界面如下:
图03:程序中屏蔽respons.end语句的执行界面
由此可见Response.end是如何有效中止代码执行的了。