当前位置: 首页 > 图文教程 > 网络编程 > ASP > 功能非常全面的日期处理函数

ASP
资料验证的asp.net程序
用ASP、VB和XML建立互联网应用程序(1)
用ASP、VB和XML建立互联网应用程序(2)
用ASP、VB和XML建立互联网应用程序(3)
用ASP、VB和XML建立互联网应用程序(4)
用XSL.ASP编辑XML文档
一个ASP.NET+XML留言本例子
股票报价的WebService之一
股票报价的WebService之二
股票报价的WebService之三
股票报价的WebService之四
股票报价的WebService之五
ASP.NET发送ICQ信息DIY(1)
ASP.NET发送ICQ信息DIY(2)
无组件图文混合上传示例
使用AspImage制作图形(一)
使用AspImage制作图形(二)
一个漂亮的点击计数器
取得服务器上用户组列表脚本之VBS版
取得服务器上用户组列表的脚本之asp版

ASP 中的 功能非常全面的日期处理函数


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 20 ::
收藏到网摘: n/a

  <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