Combining VBScript and HTML in ASP


ASP allows the manipulation of every aspect of HTML code or text during the creation of an ASP web page.


<% @LANGUAGE = VBScript %>
<% Option Explicit %>

<%
Response.Expires = 0      ' in minutes
Dim dtmTime, dtmLater, dtmDiff
dtmTime = Time
dtmLater = DateAdd("h",1,dtmTime)
dtmDiff = DateDiff("h",Now,#1/1/2000#)
%>

<HTML>
<BODY>

Hello User.<BR>
The server's time is: <%= dtmTime %>.<BR>
In one hour the server's time will be: <%= dtmLater %>.<BR>

<%
If dtmDiff > 0 Then
  Response.Write "Still " & dtmDiff & " hours "
  Response.Write "to go till year 2000.<BR>" & VbCrLf
ElseIf dtmDiff < 0 Then
  Response.Write "Already " & Abs(dtmDiff) & " hours passed since "
  Response.Write "the beginning of the year 2000.<BR>" & VbCrLf
Else
  Response.Write "The year 2000 has just begun.<BR>" & VbCrLf
  Response.Write "<B>HAPPY NEW YEAR !</B><BR>" & VbCrLf
End If
%>