澳门二十一点游戏赌场 澳门二十一点游戏赌场
    您现在的位置:首页 >> 软件应用 >> ASP教程 >> 内容

    日历源程序

    时间:2012/7/23 20:43:40 点击:

      核心提示:亮显示当天,能够选取某天显示,并能够加入事件。'*******************************************************'* ASP 101 Sample Cod...
    亮显示当天,能够选取某天显示,并能够加入事件。
    <%
    '*******************************************************
    '* ASP 101 Sample Code - http://www.asp101.com *
    '* *
    '* This code is made available as a service to our *
    '* visitors and is provided strictly for the *
    '* purpose of illustration. *
    '* *
    '* Please direct all inquiries to webmaster@asp101.com *
    '*******************************************************
    %>

    <%
    ' ***Begin Function Declaration***
    ' New and improved GetDaysInMonth implementation.
    ' Thanks to Florent Renucci for pointing out that I
    ' could easily use the same method I used for the
    ' revised GetWeekdayMonthStartsOn function.
    Function GetDaysInMonth(iMonth, iYear)
    Dim dTemp
    dTemp = DateAdd("d", -1, DateSerial(iYear, iMonth + 1, 1))
    GetDaysInMonth = Day(dTemp)
    End Function

    ' Previous implementation on GetDaysInMonth
    'Function GetDaysInMonth(iMonth, iYear)
    ' Select Case iMonth
    ' Case 1, 3, 5, 7, 8, 10, 12
    ' GetDaysInMonth = 31
    ' Case 4, 6, 9, 11
    ' GetDaysInMonth = 30
    ' Case 2
    ' If IsDate("February 29, " & iYear) Then
    ' GetDaysInMonth = 29
    ' Else
    ' GetDaysInMonth = 28
    ' End If
    ' End Select
    'End Function

    Function GetWeekdayMonthStartsOn(dAnyDayInTheMonth)
    Dim dTemp
    dTemp = DateAdd("d", -(Day(dAnyDayInTheMonth) - 1), dAnyDayInTheMonth)
    GetWeekdayMonthStartsOn = WeekDay(dTemp)
    End Function

    Function SubtractOneMonth(dDate)
    SubtractOneMonth = DateAdd("m", -1, dDate)
    End Function

    Function AddOneMonth(dDate)
    AddOneMonth = DateAdd("m", 1, dDate)
    End Function
    ' ***End Function Declaration***


    Dim dDate ' Date we're displaying calendar for
    Dim iDIM ' Days In Month
    Dim iDOW ' Day Of Week that month starts on
    Dim iCurrent ' Variable we use to hold current day of month as we write table
    Dim iPosition ' Variable we use to hold current position in table


    ' Get selected date. There are two ways to do this.
    ' First check if we were passed a full date in RQS("date").
    ' If so use it, if not look for seperate variables, putting them togeter into a date.
    ' Lastly check if the date is valid...if not use today
    If IsDate(Request.QueryString("date")) Then
    dDate = CDate(Request.QueryString("date"))
    Else
    If IsDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-" &
    Request.QueryString("year")) Then
    dDate = CDate(Request.QueryString("month") & "-" & Request.QueryString("day") & "-"
    & Request.QueryString("year"))
    Else
    dDate = Date()
    ' The annoyingly bad solution for those of you running IIS3
    If Len(Request.QueryString("month")) <> 0 Or Len(Request.QueryString("day")) <> 0 Or
    Len(Request.QueryString("year")) <> 0 Or Len(Request.QueryString("date")) <> 0 Then
    Response.Write "The date you picked was not a valid date. The calendar
    was set to today's date.

    "
    End If
    ' The elegant solution for those of you running IIS4
    'If Request.QueryString.Count <> 0 Then Response.Write "The date you picked was not
    a valid date. The calendar was set to today's date.

    "
    End If
    End If

    'Now we've got the date. Now get Days in the choosen month and the day of the week it starts on.
    iDIM = GetDaysInMonth(Month(dDate), Year(dDate))
    iDOW = GetWeekdayMonthStartsOn(dDate)

    %>









    SubtractOneMonth(dDate) %>">&lt;&lt;
    <%=
    MonthName(Month(dDate)) & " " & Year(dDate) %>

    AddOneMonth(dDate) %>">&gt;&gt;





    Sun
    SRC="./images/spacer.gif" WIDTH=60 HEIGHT=1 BORDER=0>
    Mon
    SRC="./images/spacer.gif" WIDTH=60 HEIGHT=1 BORDER=0>
    Tue
    SRC="./images/spacer.gif" WIDTH=60 HEIGHT=1 BORDER=0>
    Wed
    SRC="./images/spacer.gif" WIDTH=60 HEIGHT=1 BORDER=0>
    Thu
    SRC="./images/spacer.gif" WIDTH=60 HEIGHT=1 BORDER=0>
    Fri
    SRC="./images/spacer.gif" WIDTH=60 HEIGHT=1 BORDER=0>
    Sat
    SRC="./images/spacer.gif" WIDTH=60 HEIGHT=1 BORDER=0>

    <%
    ' Write spacer cells at beginning of first row if month doesn't start on a Sunday.
    If iDOW <> 1 Then
    Response.Write vbTab & "" & vbCrLf
    iPosition = 1
    Do While iPosition < iDOW
    Response.Write vbTab & vbTab & "&nbsp;" & vbCrLf
    iPosition = iPosition + 1
    Loop
    End If

    ' Write days of month in proper day slots
    iCurrent = 1
    iPosition = iDOW
    Do While iCurrent <= iDIM
    ' If we're at the begginning of a row then write TR
    If iPosition = 1 Then
    Response.Write vbTab & "" & vbCrLf
    End If

    ' If the day we're writing is the selected day then highlight it somehow.
    If iCurrent = Day(dDate) Then
    Response.Write vbTab & vbTab & "" &
    iCurrent & "


    " & vbCrLf
    Else
    Response.Write vbTab & vbTab & "& "-" & iCurrent & "-" & Year(dDate) & """>" & iCurrent & "

    " &
    vbCrLf
    End If

    ' If we're at the endof a row then write /TR
    If iPosition = 7 Then
    Response.Write vbTab & "" & vbCrLf
    iPosition = 0
    End If

    ' Increment variables
    iCurrent = iCurrent + 1
    iPosition = iPosition + 1
    Loop

    ' Write spacer cells at end of last row if month doesn't end on a Saturday.
    If iPosition <> 1 Then
    Do While iPosition <= 7
    Response.Write vbTab & vbTab & "&nbsp;" & vbCrLf
    iPosition = iPosition + 1
    Loop
    Response.Write vbTab & "" & vbCrLf
    End If
    %>


















    作者:佚名 来源:不详

    共有评论 0相关评论
    发表我的评论
    • 大名:
    • 内容:
  • 澳门二十一点游戏赌场(www.0769online.com) © 2018 版权所有 All Rights Reserved. 邮箱:103150@qq.com 业务QQ:103150 手机:13549753683

    Power By Laoy8 SQL 3.0SP1 粤ICP备10098668号
  •