熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

asp制作的日歷程序

2013-11-13 10:45:57  來源: .NET編程 

  純ASP打造的日歷程序可自行美化這裡僅提供最簡單的CSS樣式

  <style>
body{fontsize:px; margin:px px; padding:}
trtd{textalign:center;}
</style>
<%
=================================
說明日歷文件
=================================
取出對應的年月博客日志數據
=======================
Ryear = CInt(requestquerystring("year"))
Rmonth = CInt(requestquerystring("month"))
If Ryear = Or Ryear = NULL Then Ryear = year(now)
If Rmonth = Or Rmonth = NULL Then Rmonth = month(now)
nowtime = Ryear&""&Rmonth&"" 得到本月第一天
nowyear = year(nowtime) 年份
nowmonth = month(nowtime) 月份
nowweekday = weekday(nowtime) 當前禮拜
獲取月天數
febdays =
If nowyear / = Then febdays =
獲取本月天數
If nowmonth = then
monthdays =
ElseIf nowmonth = Then
monthdays = febdays
ElseIf nowmonth = Then
monthdays =
ElseIf nowmonth = Then
monthdays =
ElseIf nowmonth = Then
monthdays =
ElseIf nowmonth = Then
monthdays =
ElseIf nowmonth = Then
monthdays =
ElseIf nowmonth = Then
monthdays =
ElseIf nowmonth = Then
monthdays =
ElseIf nowmonth = Then
monthdays =
ElseIf nowmonth = Then
monthdays =
Else
monthdays =
End If
calendar = "<a calendarasp?year="&nowyear &"&month="&nowmonth&"> &lt;&lt;</a>&nbsp;"
willshowmonthmonth = nowmonth
If willshowmonthmonth <= Then willshowmonthmonth =
calendar = calendar & "<a calendarasp?year="&nowyear&"&month="&willshowmonthmonth &"> &lt;</a>&nbsp;"
If willshowmonthmonth + > Then willshowmonthmonth =
calendar = calendar & "<a calendarasp?year="&nowyear&"&month="&willshowmonthmonth + &"> &gt;</a>&nbsp;"
calendar = calendar & "<a calendarasp?year="&nowyear + &"&month="&nowmonth&"> &gt;&gt;</a>&nbsp;"
calendar = calendar & "<table bgcolor=# cellspacing= width=><tr bgcolor=#ffffff><td colspan=>"&nowyear&""&nowmonth&""&day(now)&"</td></tr>"&VBCRLF
calendar = calendar & " <tr bgcolor=#ffffff>"&VBCRLF
calendar = calendar & "<td>日</td>"&VBCRLF
calendar = calendar & "<td>一</td>"&VBCRLF
calendar = calendar & "<td>二</td>"&VBCRLF
calendar = calendar & "<td>三</td>"&VBCRLF
calendar = calendar & "<td>四</td>"&VBCRLF
calendar = calendar & "<td>五</td>"&VBCRLF
calendar = calendar & "<td>六</td>"&VBCRLF
calendar = calendar & "</tr>"&VBCRLF
calendar = calendar & VBCRLF&"<tr bgcolor=#ffffff>"&VBCRLF
把前面的空白補充出來
nowmonthfirstiweekday = weekday(nowyear&""&nowmonth&"") 本月第一天的星期
For i= To nowmonthfirstiweekday
calendar = calendar & "<td bgcolor=#efefef>&nbsp;</td>"&VBCRLF
Next
開始循環寫日期
t=
For i= To monthdays
If year(now) = year(nowyear&""&nowmonth&""&i) and day(now) = day(nowyear&""&nowmonth&""&i) Then 高亮顯示今日

calendar = calendar & "<td bgcolor=#cccccc><a >"&i&"</a></td>"&VBCRLF
Else
calendar = calendar & "<td>"&i&"</td>"&VBCRLF
End If

If weekday(nowyear&""&nowmonth&""&i) = Then
t=t+
calendar = calendar & "</tr><tr bgcolor=#ffffff>"&VBCRLF
End if
Next
For i= To (*t(nowmonthfirstiweekday++monthdays))
calendar = calendar & "<td bgcolor=#ffffff></td>"&VBCRLF
Next
calendar = calendar & VBCRLF&"</tr>"
calendar = calendar & "</table>"&VBCRLF
ResponseWrite calendar
%>


From:http://tw.wingwit.com/Article/program/net/201311/14465.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.