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

ASP
二文件上传,才30行代码
用ASP制作在线测试
三级下拉框连动的数据库版
用户注册及跟踪代码(一)
用户注册及跟踪代码(二)
用户注册及跟踪代码(三)
ASP.Net写的浏览器间谍
ASP实现播放Flash的例子
用DataList控件开发一个简单的留言本程序
aspemail组件的应用
编写数据库脚本
用ASP建立邮件列表
用ASP技术编制隐藏用户密码程序
用ASP统计用户在站点的停留时间
HTTP方式上载文件的ASP程序实例
使用VB编写纯ASP程序
用ASP统计用户在站点的停留时间(1)
用ASP统计用户在站点的停留时间(2)
用ASP实现论坛的UBB功能(一)
用ASP实现论坛的UBB功能(二)

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 27 ::
收藏到网摘: 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