Date Processing functions
<Script language = JavaScript>
Function fnsubmit (strpage)
{
Document. Forms [0]. Action = strpage
Document. Forms [0]. Submit ()
}
</SCRIPT>
<%
Call writedropdowns
Sub writedropdowns ()
Dim strselflink
Strselflink = request. servervariables ("script_name ")
Response. Write "<form name = dates method = post>" & vbcrlf
Response. write monthdropdown ("month1", false, request ("month1"), strselflink) & "" & daydropdown ("day1", "", getdaysinmonth (Request ("month1 "), request ("year1"), request ("day1") & "& yeardropdown (" year1 "," "," ", request (" year1 "), strselflink) & vbcrlf
Response. Write "</form>" & vbcrlf
End sub
Function monthdropdown (strname, blnnum, strselected, strselflink)
Dim strtemp, I, strselectedstring
Strtemp = "<select name = '" & strname & "'onchange = 'javascript: fnsubmit (" & CHR (34) & strselflink & CHR (34 )&") '> "& vbcrlf
Strtemp = strtemp & "<option value = '" & 0 & "'>" & "month" & "</option>" & vbcrlf
For I = 1 to 12
If strselected = CSTR (I) then
Strselectedstring = "selected"
Else
Strselectedstring = ""
End if
If blnnum then
Strtemp = strtemp & "<option value = '" & I & "'" & strselectedstring & ">" & I & "</option>" & vbcrlf
Else
Strtemp = strtemp & "<option value = '" & I & "'" & strselectedstring & ">" & monthname (I) & "</option>" & vbcrlf
End if
Next
Strtemp = strtemp & "</SELECT>" & vbcrlf
Monthdropdown = strtemp
End Function
Function yeardropdown (strname, intstartyear, intendyear, strselected, strselflink)
Dim strtemp, I, strselectedstring
If intstartyear = "" then
Intstartyear = year (now ())
End if
If intendyear = "" then
Intendyear = year (now () + 9
End if
Strtemp = "<select name = '" & strname & "'onchange = 'javascript: fnsubmit (" & CHR (34) & strselflink & CHR (34 )&") '> "& vbcrlf
Strtemp = strtemp & "<option value = '" & 0 & "'>" & "year" & "</option>" & vbcrlf
For I = intstartyear to intendyear
If strselected = CSTR (I) then
Strselectedstring = "selected"
Else
Strselectedstring = ""
End if
Strtemp = strtemp & "<option value = '" & I & "'" & strselectedstring & ">" & I & "</option>" & vbcrlf
Next
Strtemp = strtemp & "</SELECT>" & vbcrlf
Yeardropdown = strtemp
End Function
Function daydropdown (strname, intstartday, intendday, strselected)
Dim strtemp, I, strselectedstring
If intstartday = "" then
Intstartday = 1
End if
If intendday = "" then
Intendday = getdaysinmonth (month (now (), Year (now ()))
End if
Strtemp = "<select name = '" & strname & "'>" & vbcrlf
Strtemp = strtemp & "<option value = '" & 0 & "'>" & "day" & "</option>" & vbcrlf
For I = intstartday to intendday
If strselected = CSTR (I) then
Strselectedstring = "selected"
Else
Strselectedstring = ""
End if
Strtemp = strtemp & "<option value = '" & I & "'" & strselectedstring & ">" & I & "</option>" & vbcrlf
Next
Strtemp = strtemp & "</SELECT>" & vbcrlf
Daydropdown = strtemp
End Function
Function getdaysinmonth (strmonth, stryear)
Dim strdays
Select case CINT (strmonth)
Case 1, 3, 5, 7, 8, 10, 12:
Strdays = 31
Case 4, 6, 9, 11:
Strdays = 30
Case 2:
If (CINT (stryear) mod 4 = 0 and CINT (stryear) mod 100 <> 0) or (CINT (stryear) mod 400 = 0) then
Strdays = 29
Else
Strdays = 28
End if
'Case else:
End select
Getdaysinmonth = strdays
End Function
%>