功能非常全面的日期处理函数
来源:网络 责任编辑:栏目编辑 发表时间:2013-07-01 05:27 点击:次
<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
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
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>