⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calendar.asp

📁 asp日历&备忘录有点像手机的日程表(备忘录)
💻 ASP
字号:
<%@ Language=VBScript %>
<%  Option Explicit %>
<!--
★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★
★                                                                  ★
☆ (请保留此处版权信息,这些内容并不会对您的网站运行有任何影响)   ☆
★                                                                  ★
☆                             asp日历&备忘录                       ☆
★                                                                  ★
☆  版权所有: www.52725.com                                         ☆
☆                                                                  ☆ 
★                                                                  ★
☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆★☆
-->
<% 
    Function FormatStr(String)
      ' Replaces a double carrige return with a paragraph break
      ' a single carrige return with a break rule and CHR(13) with nothing
      String = Replace(String, CHR(13), "")
      String = Replace(String, CHR(10) & CHR(10), "</P><P>")
      String = Replace(String, CHR(10), "<BR>")
      FormatStr = String
    End Function

' ---------- Page Variables ----------
    Const intCharToShow = 19		' The number of characters shown in each day
    Const bolEditable   = True		' If the calendar is editable or not (Can be tied into password verification)

    Dim dtToday 			' Today's Date
    Dim dtCurrentDate			' The current date
    Dim aCalendarDays(42)		' Array of possible calendar dates
    Dim iFirstDayOfMonth		' The first day of the month
    Dim iDaysInMonth	 		' The number of days in the month
    Dim iColumns, iRows	, iDay, iWeek	' The numer of columns and rows in the table, and counters to print them
    Dim objConn, strConn, strSQL, objRS ' Database Variables
    Dim counter 			' Loop counter
    Dim strNextMonth, strPrevMonth	' The next and previous month dates
    Dim dailyMsg			' The message for the day
    Dim dtOnDay				' The current day being displayed by the loops
    Dim strPage				' The link that each day takes you too

' ---------- Variable Definitions ----------
    dtToday 	  = Date()

    If Request("currentDate") <> "" Then
      dtCurrentDate = Request("currentDate")
    Else
      dtCurrentDate = dtToday
    End If

    iFirstDayOfMonth = DatePart("w", DateSerial(Year(dtCurrentDate), Month(dtCurrentDate), 1))
    iDaysInMonth = DatePart("d", DateSerial(Year(dtCurrentDate), Month(dtCurrentDate)+1, 1-1))

    For counter = 1 to iDaysInMonth
      aCalendarDays(counter + iFirstDayOfMonth - 1) = counter
    Next

    iColumns = 7
    iRows    = 6 - Int((42 - (iFirstDayOfMonth + iDaysInMonth)) / 7)

    strPrevMonth = Server.URLEncode(DateAdd("m", -1, dtCurrentDate))
    strNextMonth = Server.URLEncode(DateAdd("m",  1, dtCurrentDate))

' ---------- Drawing the Calendar ----------
%>

<HTML>
<HEAD>
  <TITLE>Caledar - <%= MonthName(Month(dtCurrentDate)) & " " & Year(dtCurrentDate) %></TITLE>
  <STYLE TYPE="text/css">
    <!--
    BODY 	    {background-color: #FFFFFF; text-align: center; font-size: 12px; font-family: Verdana;}
    A 		    {text-decoration: none;}
    A:active 	    {color: #000000;}
    A:visited 	    {color: #000000;}
    A:link 	    {color: #000000;}
    A:hover 	    {color: #D80E0E;}
    .blackBacking   {background-color: #000000;}
    .names 	    {background-color: #ff9900; font-size: 13px; color: #FFFFFF; text-decoration: none; text-align:  center; font-family: Verdana; font-weight: bold;}
    .calendarBody   {background-color: #F2EBCB; font-size: 12px; color: #000000; text-decoration: none; text-align:  center; font-family: Verdana;}
    .calCurrentDay  {background-color: #F0D145; font-size: 11px; color: #FFFFFF;}
    .calOtherDay    {background-color: #F2EBCB; font-size: 11px; color: #000000;}
    .calNotDay	    {background-color: #F2EBCB; font-size: 11px; color: #000000;}
    .calFormMenu    {background-color: #AECE6A; font-size: 13px; color: #FFFFFF; text-decoration: none; text-align:  center; font-family: Verdana; font-weight: bold;}
    -->
  </STYLE>
</HEAD>
<BODY>
  <FORM NAME="pageForm" ACTION="calendar.asp" METHOD="GET">
  <CENTER>
  <TABLE CELLPADDING=0 CELLSPACING=0 WIDTH=600 BORDER=0>
    <TR>
      <TD CLASS="blackBacking">
	<TABLE CELLSPACING=1 CELLPADDING=1 BORDER=0 WIDTH=600>
  	  <TR HEIGHT=30px>
  	    <TD CLASS="names" HEIGHT=30px COLSPAN=7>
	      <A HREF="calendar.asp?currentDate=<%= strPrevMonth %>">&laquo; Prev</A>
	      &nbsp;
	      <SELECT NAME="currentDate" CLASS="calFormMenu" onChange="pageForm.submit()">
	      <% For counter = 1 to 12 %>
	        <OPTION VALUE="<%= DateSerial(Year(dtCurrentDate), counter, 1) %>" <% If (DatePart("m", dtCurrentDate) = counter) Then Response.Write "SELECTED"%>><%= MonthName(counter) & " " & Year(dtCurrentDate) %></OPTION>
	      <% Next %>
	      </SELECT>
	      &nbsp;
	      <A HREF="calendar.asp?currentDate=<%= strNextMonth %>">Next &raquo;</A> 
            </TD>
          </TR>
	  <!-- Writring the days of the week for headers -->
          <TR VALIGN="TOP" ALIGN="CENTER">
            <% For iDay = vbSunday To vbSaturday %>
            <TD WIDTH="14%" class="names"><%= WeekDayName(iDay, True) %>.</TD>
            <% Next %>
          </TR>
<%
    Set objConn = Server.CreateObject("ADODB.Connection") 
    strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("db.mdb") & ";Persist Security Info=False;"
    objConn.Open(strConn) 

    For iWeek = 1 To iRows
      Response.Write "<TR VALIGN=TOP>"
      For iDay = 1 To iColumns
	' Checks to see if there is a day this month on the date being written
	If aCalendarDays((iWeek-1)*7 + iDay) > 0 then
	  dtOnDay = DateSerial(Year(dtCurrentDate), Month(dtCurrentDate), aCalendarDays((iWeek-1)*7 + iDay))

	  ' Checks to see if the day being printed is today
	  If dtOnDay = dtToday Then
	    Response.Write "<TD HEIGHT=55 CLASS='calCurrentDay'>"
 	  Else
   	    Response.Write "<TD HEIGHT=55 CLASS='calOtherDay'>"
 	  End If

	  ' Checks to see the type of calendar (editable or non-editable)
 	  If (bolEditable) then
   	    strPage = "updateCalendar_form.asp?currentDate=" & dtOnDay
 	  Else
   	    strPage = "viewDay.asp?currentDate=" & dtOnDay
	  End If

	  ' Checks for a message on the day being written
	  strSQL = "SELECT * FROM calendar WHERE calendarDate = #" & dtOnDay & "#"
	  Set objRS = objConn.Execute(strSQL)
	  If NOT objRS.EOF Then 
	    dailyMsg = objRS("calendarText")
	  Else 
	    dailyMsg = ""
	  End If
	  Set objRS = Nothing

	  ' Checks to see if the message is too long to be displayed in the mini date box
          If (Trim(dailyMsg) = Trim(Left(dailyMsg, intCharToShow))) Then
	  Else 
	     dailyMsg = Trim(Left(dailyMsg, intCharToShow-4)) & " ..."
          End If

 	  Response.Write ("<A HREF=""" & strPage & """>&nbsp;" & aCalendarDays((iWeek-1)*7 + iDay) & "<BR>&nbsp;&nbsp;" & FormatStr(dailyMsg) & "</A>")
	Else 
	  Response.Write ("<TD HEIGHT=50 CLASS='calNotDay'>&nbsp;")
	End IF

	Response.Write "</TD>"
      Next
      Response.Write "</TR>"
    Next

    objConn.Close
    set objConn = Nothing
%>

	</TABLE>
      </TD>
    </TR>
  </TABLE>
<%
    ' Notification for the user to know that the calendar is editable
    If (bolEditable) Then Response.Write "<h6>ASP日历&备忘录<h6><BR>"
%>
  </FORM>

  <!-- 请保留本站链接信息 -->
 <h6><td height="20"><div align="center"><a href="http://my.52725.com/message" target="_blank"><font color="#FF9933">给我们留言</a> 
 <FONT COLOR="#000000" FACE="Verdana" SIZE="1">
  Copyright &copy; 2005. All Rights Reserved.<BR>
  Powered By: <A HREF="http://www.52725.com" target=blank><font color="#FF9933">www.52725.com</A>
  </FONT>
<h6><td height="20"><div align="center"><a href="http://my.52725.com/3/916.htm" target="_blank"><font color="#FF9933">使用必读</a> 
  <!-- 请保留本站链接信息 -->

  </CENTER>
</BODY>
</HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -