I have coded my first ASP page however IE will not display my ASP page. My internet host supports VBscript and ASP. I am running Windows 2000 which (I thought) came with IIS. My file is named Calendar.asp. Can anyone tell me what I am missing?
Here is my code:
<%@ LANGUAGE - VBScript %>
<% option explicit %>
<html>
<head>
<title>Calendar</title>
</head>
<body>
<%
'Get month name
function GetMonthName(iMonth)
Select Case iMonth
Case 1:
GetMonthName = "January"
Case 2:
GetMonthName = "February"
Case 3:
GetMonthName = "March"
Case 4:
GetMonthName = "April"
Case 5:
GetMonthName = "May"
Case 6:
GetMonthName = "June"
Case 7:
GetMonthName = "July"
Case 8:
GetMonthName = "August"
Case 9:
GetMonthName = "September"
Case 10:
GetMonthName = "October"
Case 11:
GetMonthName = "November"
Case 12:
GetMonthName = "December"
Case else:
GetMonthName = "**INVALID MONTH**"
End Select
End Function
'Get current date
Dim dbCurrentDate
dbCurrentDate = Date()
'Create array that will store max number of cells (42)
dim aCalendarDays(42)
'Determine the weekday the first day of the month
'falls on (ie. monday, tuesday etc,)
iFirstWeekDay = DatePart("w", DateSerial(dbCurrentDate), _
Month(dbCurrentDate),1))
'Determind number of days in the current month
dim iDaysInMonth
iDaysInMonth = DatePart("d", DateSerial(Year(dbCurretnDate), _
Month(dbCurrentDate),1, 1-1))
'Now loop from 1 to number of days in the current month
'populating the array aCalendarDays
dim iLoop
for iLoop = 1 to iDaysInMonth
aCalendarDays(iLoop + iFirstWeekDay -1) = iLoop
'Display the array in calendar form. Black out days that
'are N/A
dim iColumns, IRows
icolumns = 7
iRows = 6 - Int((42 - (iFirstWeekDay + iDaysInMonth)) / 7)
%>
<TABLE ALIGN=CENTER BORDER=1 CELLSPACING=1 WIDTH=75% TEIGHT=75%
<TH COLSPAN=7>
<FONTSIZE=+2>
<%
'Display the month and year
Response.write GetMonthName(month(dbCurrentDate))
response.write ", " & Year(dbCurrentDate)
%>
</FONT>
</TH>
<%
'Loop thru 1 thru iRows, then 1 thru iColumns
dim iRowsLoop, iColumnsLoop
For iRowsLoop = 1 to iRows
'Create a new row
Response.write "<TR>"
For iColumnsLoop = 1 to iColumns
'Create a new col
If aCalendarDays((iRowsLoop -1)*7 + IColumnsLoop) > 0 then
response.write "<TD VALIGN=TOP ALIGN=RIGHT WIDTH=""14%"">"
Response.Write aCalendarDays((iRowsLoop-1)*7 + iColumnsLoop)
Response.write "</TD>"
else
Response.write <TD BGCOLOR=BLACK>&NBSP;</TD>"
End if
Next
'close the row
response.write "</TR>"
%>
</Table>
</body>
</html>
Thank you,
Trudye
Here is my code:
<%@ LANGUAGE - VBScript %>
<% option explicit %>
<html>
<head>
<title>Calendar</title>
</head>
<body>
<%
'Get month name
function GetMonthName(iMonth)
Select Case iMonth
Case 1:
GetMonthName = "January"
Case 2:
GetMonthName = "February"
Case 3:
GetMonthName = "March"
Case 4:
GetMonthName = "April"
Case 5:
GetMonthName = "May"
Case 6:
GetMonthName = "June"
Case 7:
GetMonthName = "July"
Case 8:
GetMonthName = "August"
Case 9:
GetMonthName = "September"
Case 10:
GetMonthName = "October"
Case 11:
GetMonthName = "November"
Case 12:
GetMonthName = "December"
Case else:
GetMonthName = "**INVALID MONTH**"
End Select
End Function
'Get current date
Dim dbCurrentDate
dbCurrentDate = Date()
'Create array that will store max number of cells (42)
dim aCalendarDays(42)
'Determine the weekday the first day of the month
'falls on (ie. monday, tuesday etc,)
iFirstWeekDay = DatePart("w", DateSerial(dbCurrentDate), _
Month(dbCurrentDate),1))
'Determind number of days in the current month
dim iDaysInMonth
iDaysInMonth = DatePart("d", DateSerial(Year(dbCurretnDate), _
Month(dbCurrentDate),1, 1-1))
'Now loop from 1 to number of days in the current month
'populating the array aCalendarDays
dim iLoop
for iLoop = 1 to iDaysInMonth
aCalendarDays(iLoop + iFirstWeekDay -1) = iLoop
'Display the array in calendar form. Black out days that
'are N/A
dim iColumns, IRows
icolumns = 7
iRows = 6 - Int((42 - (iFirstWeekDay + iDaysInMonth)) / 7)
%>
<TABLE ALIGN=CENTER BORDER=1 CELLSPACING=1 WIDTH=75% TEIGHT=75%
<TH COLSPAN=7>
<FONTSIZE=+2>
<%
'Display the month and year
Response.write GetMonthName(month(dbCurrentDate))
response.write ", " & Year(dbCurrentDate)
%>
</FONT>
</TH>
<%
'Loop thru 1 thru iRows, then 1 thru iColumns
dim iRowsLoop, iColumnsLoop
For iRowsLoop = 1 to iRows
'Create a new row
Response.write "<TR>"
For iColumnsLoop = 1 to iColumns
'Create a new col
If aCalendarDays((iRowsLoop -1)*7 + IColumnsLoop) > 0 then
response.write "<TD VALIGN=TOP ALIGN=RIGHT WIDTH=""14%"">"
Response.Write aCalendarDays((iRowsLoop-1)*7 + iColumnsLoop)
Response.write "</TD>"
else
Response.write <TD BGCOLOR=BLACK>&NBSP;</TD>"
End if
Next
'close the row
response.write "</TR>"
%>
</Table>
</body>
</html>
Thank you,
Trudye