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

ASP
构建你的网站新闻自动发布系统之三
构建你的网站新闻自动发布系统之四
如何用ASP编写网站统计系统一
如何用ASP编写网站统计系统二
如何用ASP编写网站统计系统三
如何用ASP编写网站统计系统四
ASP Error 0115的一些解决办法
ASP 3.0 新特色先睹为快(一)
ASP 3.0 新特色先睹为快(二)
ASP主件中的安全问题
一个汉字转成拼音的代码
使用w3Sockets组件实现域名查询功能
ASP中实现文件上传方法的研究
构建免受FSO组件威胁虚拟主机
用XMLHTTP做一个自己特色的Google
用asp实现的代码批量修改程序
无组件的数据库的备份与还原
用ASPJPEG组件制作图片的缩略图和加水印
解密ASP源代码
XmlHttp异步获取网站数据的例子

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


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