1<script language="javascript">
2function fnSubmit(strPage)
3{
4document.forms[0].action= strPage
5document.forms[0].submit()
6}
7
8</script>
1
2
3call writedropdowns
4
5Sub writeDropDowns()
6Dim strSelfLink
7strSelfLink = request.servervariables("SCRIPT_NAME")
8response.Write "
<form method="post" name="dates">" & 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>
1" & vbcrlf
2End Sub
3
4
5Function MonthDropDown(strName, blnNum, strSelected, strSelfLink)
6Dim strTemp, i, strSelectedString
7strTemp = "
<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 "="" &="" strselectedstring="" value='" & i & "'>" & i & "</option>" & vbcrlf
Else
strTemp = strTemp & "<option "="" &="" strselectedstring="" value='" & i & "'>" & MonthName(i) & "</option>" & vbcrlf
End If
Next
strTemp = strTemp & "</select>
1" & vbcrlf
2MonthDropDown = strTemp
3End Function
4
5
6Function YearDropDown(strName, intStartYear, intEndYear, strSelected, strSelfLink)
7
8Dim strTemp, i, strSelectedString
9
10If intStartYear = "" Then
11intStartYear = Year(now())
12End If
13
14If intEndYear = "" Then
15intEndYear = Year(now()) + 9
16End If
17
18strTemp = "
<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 "="" &="" strselectedstring="" value='" & i & "'>" & i & "</option>" & vbcrlf
Next
strTemp = strTemp & "</select>
1" & vbcrlf
2YearDropDown = strTemp
3End Function
4
5
6Function DayDropDown(strName, intStartDay, intEndDay, strSelected )
7Dim strTemp, i, strSelectedString
8If intStartDay = "" Then
9intStartDay = 1
10End If
11
12If intEndDay = "" Then
13intEndDay = getDaysInMonth(Month(now()),Year(now()))
14End If
15
16strTemp = "
<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 "="" &="" strselectedstring="" value='" & i & "'>" & i & "</option>" & vbcrlf
Next
strTemp = strTemp & "</select>
1" & vbcrlf
2DayDropDown = strTemp
3End Function
4
5
6Function getDaysInMonth(strMonth,strYear)
7Dim strDays
8Select Case CInt(strMonth)
9Case 1,3,5,7,8,10,12:
10strDays = 31
11Case 4,6,9,11:
12strDays = 30
13Case 2:
14If ( (CInt(strYear) Mod 4 = 0 And CInt(strYear) Mod 100 <> 0) Or ( CInt(strYear) Mod 400 = 0) ) Then
15strDays = 29
16Else
17strDays = 28
18End If
19'Case Else:
20End Select
21
22getDaysInMonth = strDays
23End Function